I know there are two ways of using external libraries in OSGI bundles. As only my package needs the lib (e.g. google-gson) I tried to put it in the Bundle-ClassPath (manifest.mf). But whenever I run the bundle in Knopflerfish I get the Exception in thread "Thread-74" [stderr] java.lang.NoClassDefFoundError: com/google/gson/Gson.
As I am new to OSGI I tried to follow the instructions for creating a bundle from here using a build.xml for compilation where I also included the lib (don't know if this is even correct). So the library appears in three different places, the project classpath, the bundle classpath (manifest.mf) and the build.xml.
I would be glad if someone could give me a hint how to make the library work. Thanks in advance!
The process as follows
1.copy all the
.jarfiles and its DEPENDENCIES to a folder2.mention it in
BUNDLE-CLASSPATHinMANIFEST.MF.Refer this3.Importantly add packages from this library to
Export-packageelement inMANIFEST.MFto make it visible for other bundles.Hope this resolves your issue