As it was written in previous answers you have two options if you want to use additional libraries in your bundles:
- embedding library jars in a bundle in which it will be used,
- creating a valid OSGi bundle from the library.
The first approach is simpler because you only need to copy library jars (and all its dependencies) to a bundle (e.g. to a root directory) and then add them to Bundle-Classpath
element in MANIFEST.MF
(see here). However, while doing this you must remember that this added library will be visible only in a bundle in which it is embedded (so library reuse is limited). You could always add packages from this library to Export-package
element in MANIFEST.MF
to make it visible for other bundles but this is far from elegant solution (however it will work).
In order to make it visible to other bundles you should use the second approach, i.e. create an OSGi bundle from the library (there are tools which can help you in doing that, also in Eclipse). However, for more complicated libraries this approach may be harder (because of dependencies and specific class loading approach in OSGi).
So if you want to use the library only in one bundle I suggest using the first approach (it is easier to implement). If you want to use this library in many bundles in your application you should consider the second approach.