How can we load a 3rd party library that is not an OSGi
bundle.
One option to load a 3rd party library that is not an OSGi
bundle is to create an extension/fragment bundle.
This can be done from the command line as follows. Lets say we have a 3rdparty.jar which contains packages under com.3rdparty.libs that need to be exported.
Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.3rdparty.extension
Bundle-Version: 1.0
Fragment-Host: system.bundle; extension:=framework
Bundle-Name: H2 JDBC Driver Extension
Bundle-Description: Bundle exporting com.3rdparty.libs
Export-Package: com.3rdparty.libs
Note that the blank line at the end of a jar manifest file is required. Also, all packages you need to export have to be explicitly added to Export-Package as a comma separated list
jar -cfm com.3rdparty.extension-1.0.jar ext.mf
OSGi
Service Platform Core for more information about Extension Bundles. Sign in to your account