Creating an OSGi bundle from a JAR file

About this task

If you have an existing JAR file that you want to use as an OSGi bundle, you can create a bundle from the JAR file. The JAR file can be in your file system or in a project in your workspace. The following two tasks describe the steps for each scenario.

Creating an OSGi bundle from a JAR file in the file system

Procedure

  1. Access the Import wizard. Click File > Import.
  2. Choose OSGi > Java Archive into an OSGi Bundle. Click Next.
  3. Choose the JAR file. In the wizard, for JAR file, click Browse then browse to the location on your hard disk for the JAR file that you want to import.
  4. Choose a bundle or create a new bundle to add the JAR file to. In the wizard, if you have an existing bundle in your workspace that you want to add the JAR file to, select the bundle from the drop-down menu. If you want to create a bundle for the JAR file, click New Bundle. If you are creating a new bundle, follow the steps of the wizard. When done, click Finish to return to the import wizard. The JAR file and Bundle fields are now populated.
  5. Click Next to proceed to the packages screen of the wizard.
  6. From the Packages list, select the packages in the JAR file that you want to be added to the Export-Package header in the bundle MANIFEST.MF file.
  7. Click Finish. A bundle is now created based on the JAR file, and export entries for selected packages in the JAR file are added to the Export-Package header of the bundle.

Creating an OSGi bundle from a JAR file in a workspace project

Procedure

  1. Access the Copy or Move into OSGi bundle wizard. Right-click a JAR file in a project in your workspace and select OSGi > Copy into OSGi bundle or select OSGi > Move into OSGi bundle. If the JAR file is in an OSGi bundle project, you are presented with the Move into OSGi bundle wizard to help avoid the possibility of the JAR file being present in two different bundle projects. For other project types, you are presented with the Copy into OSGi bundle wizard.
  2. Choose a bundle or create a new bundle to add the JAR file to. In the wizard, if you have an existing bundle in your workspace that you want to add the JAR file to, select the bundle from the drop-down menu. If you want to create a bundle for the JAR file, click New Bundle. If you are creating a new bundle, follow the steps of the wizard. When done, click Finish to return to the import wizard. The JAR file and Bundle fields are now populated.
  3. Click Next to proceed to the packages screen of the wizard.
  4. From the Packages list, select the packages in the JAR file that you want to be added to the Export-Package header in the bundle MANIFEST.MF file.
  5. Click Finish. A bundle is now created based on the JAR file, and export entries for selected packages in the JAR file are added to the Export-Package header of the bundle.
Icon that indicates the type of topic Task topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: tcrtbundlefromjar.html