Including a JAR file in an OSGi application

About this task

You can include a JAR file directly in your OSGi application. If you want to use packages in the JAR file in your application, and you want the packages to be included in a self-contained OSGi application, you can include the JAR file in your application. JAR files that you want to include in your application must be in OSGi bundle format. Perform the following steps to add a JAR file to your application.

Procedure

  1. Create an OSGi bundle from the JAR file. If the JAR file is not already an OSGi bundle, create a bundle that is based on the JAR file. For details on how to create an OSGi bundle, see Creating an OSGi bundle from a JAR file. If you are unsure whether a JAR file is already a bundle, open up the JAR file and ensure that there is a META-INF/MANIFEST.MF file in the JAR file that contains a Bundle-SymbolicName header with the name of the bundle.
  2. Ensure that the bundle is in the workspace. If you created a bundle from the JAR file, the new bundle is in your workspace. If the JAR file was already a bundle but not in your workspace, import the bundle. To import the bundle, click File > Import > OSGi > OSGi Bundle or Fragment. Follow the steps of the wizard to import the bundle.
  3. Add the bundle to your application. Double-click the APPLICATION.MF file in your OSGi application and select the Overview tab. The manifest editor opens. In the Contained Bundles section, click Add. Select the bundle that you want to include in your application. Click OK to add the bundle.
Icon that indicates the type of topic Task topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: tincludejar.html