Including Non-OSGi Jars in Projects
You can include libraries in your project’s lib folder. The libraries that you add in this folder will be included in the classpath of your project bundle. In this way you can include non-OSGi jars in your project bundle’s classpath. The jars you add in the lib folder will be available only to your project’s classes. To include non-OSGi jars in your project, navigate to your project’s lib folder and add the files you require in it.
For example, if you add the jfind.jar in the lib folder, the generated project bundle will contain the jfind.jar and the OSGi Bnd template will contain the following header attribute: Bundle-ClassPath: .,lib/jfind.jar. The OSGi container will include the classes of your jar file in your project bundle’s classpath when you publish the bundle. However, the packages of the jar file will not be exported and will be resolved only by classes inside the bundle.
Related Topics