Is it possible to use a non-osgi library with an OSGi application?
For an example, I'm developing a semantic based search engine, and I am using a third party Natural Language Processing library for it (http://wiki.opencog.org/w/RelEx_Dependency_Relationship_Extractor).
Is it possible to interface such a library which doesn't suport OSGi, as a couple of jar files, with my OSGi application?
As it was written in previous answers you have two options if you want to use additional libraries in your bundles:
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.