The Felix web site and documentation are maintained on our wiki.

In an effort to make it easier to find desired documentation, we have divided our documentation section into the following six areas:

  • Getting started - This area captures a few links from the areas below that will help you get started with Felix.
  • FAQs - This area captures all FAQ documentation, which typically varies from subproject to subproject.
  • Community - This area captures documentation associated with how the Felix community works and how to become involved in it.
  • Development - This area captures documentation for Felix developers or those interested in becoming Felix developers; this is not intended for Felix users although some information may be useful.
  • Subprojects - This area captures user documentation for the various Felix subprojects.
  • Tutorials, examples, and presentations - This area captures general user documentation that does not necessarily fit into any single subproject.

If you are unable to find the documentation you need, please ask on the mailing lists. Also, feedback on improving the documentation and/or organization of this site is welcome.

  • No labels

1 Comment

  1. Apache Felix and Google Android




    The purpose of this document is to explain how to use Apache Felix on Google's new mobile phone platform - Android


    Dalvik VM

    Google Android SDK allows developers to write Java code in order to create Android applications. Instead of a regular Java Virtual Machine that executes this code, a special-purpose virtual machine named Dalvik is being used in order to comply with mobile platform requirements. Dalvik does not use Java bytecode format, but, a tool named dx, included in the Android SDK, transforms the Java class files of Java classes compiled by a regular Java compiler into another class file format (the .dex format) (the conversion is not done at runtime).


    Preparing bundles

    Although latest version of Felix, 1.0.3, has now built in support for Android, there are still some things needed to be done in order to successfully make use of it ( you will need to install Android SDK and you should have <android_SDK_HOME>/tools added to system PATH variable). The zip file available for download has been created in the same manner.

            1. Each JAR file you use, either as a Felix library or as a bundle, should contain its DEX equivalent:

    a)     create DEX file for your JAR

    dx --dex --output=classes.dex JAR_file.jar


    b)     add DEX file into the JAR

    aapt add JAR_file.jar classes.dex

    2. The processed JARs should be made available to Android by transferring them to the emulator:

    emulator &
    adb push JAR_file.jar path_emulator/JAR_file.jar


    3. Referring to the sample project, these are the steps we followed:

    osgi-android: /
    \- bin
    \- bundle
    \- conf

    a)     prepare felix JAR

    export PATH=<path-to-android>/tools:$PATH
    cd bin
    dx --dex --output=classes.dex felix.jar
    aapt add felix.jar classes.dex


    b)     prepare bundle JARS

    cd bundle
    dx --dex --output=classes.dex
    aapt add classes.dex
    dx --dex --output=classes.dex
    aapt add classes.dex
    dx --dex --output=classes.dex EnglishDictionary.jar
    aapt add EnglishDictionary.jar classes.dex
    dx --dex --output=classes.dex FrenchDictionary.jar
    aapt add FrenchDictionary.jar classes.dex
    dx --dex --output=classes.dex SpellChecker.jar
    aapt add SpellChecker.jar classes.dex


    c)     transfer them all to the emulator (Please note that you need some kind of unix-ish shell (Mac OS X works fine, linux should too) or translate the instructions to your own platform.)

    cd osgi-android
    emulator &
    find * -type f -exec adb push {} /root/felix/{} \;


    Launching Felix

    Once you've done that, you should be able to launch Felix and referred bundles on Android: start emulator shell, change directory to the location of your Felix files and execute

    adb shell
    cd /root/felix
 contains a unix command that launches Felix main class using the actual runtime of the emulator.

    /system/bin/dalvikvm -Xbootclasspath:/system/framework/core.jar \
      -classpath bin/felix.jar org.apache.felix.main.Main

    If all went well, you should see the Felix command line shell now. Type "help" for further instructions.

    You may now install and launch EnglishDictionary , FrenchDictionary and SpellChecker bundles to test how Felix is working. These are all examples from the Apache Felix OSGI tutorial and correspond to Apache Felix Tutorial Example 2, Apache Felix Tutorial Example 2b and Apache Felix Tutorial Example 5 respectively.

    • EnglishDictionary - supplies a Dictionary service implementation with the following collection of words "welcome", "to", "the", "osgi", "tutorial"
    • FrenchDictionary - supplies a Dictionary service implementation with the following collection of words "bienvenue", "au", "tutoriel", "osgi"
    • SpellChecker - supplies a spell checker that retrieves the first Dictionary implementation it finds and checks if the word you've entered is in the dictionary or not.
    start file:bundle/EnglishDictionary.jar
    start file:bundle/FrenchDictionary.jar
    start file:bundle/SpellChecker.jar


    Embedding Felix

    Apache Felix can also be integrated with an Android application.
    To achieve this, you need to embed Felix into onCreate() method of your Activity class (see Android docs for more details on how to use an Activity) and process your bundles as shown above.



    The project zip file