You need to specify within this MANIFEST.MF file what your execution entry point class is.
Which is a directory that creates the MANIFEST.MF file.
class files, it will also create: META-INF/ When you create an executable jar file, not only will it create an internal directory structure with. java source file, you can add it as: package public class ClassOne This can be done with the package statement. java), you will need to assign them to their directory structure location. This directory structure will contain your. That’s it - the resulting jar file is an OSGi bundle the exports the packages listed in Export-Package above, using the classes of the embedded junit-4.4.jar.First, you will need to create a directory structure that will match what you wish to contain in the jar. Where manifest.txt is the name of the manifest file created above.
- Export-Package is a list of packages contained in the jar that you would like to make available to other bundles running in the OSGi Container.Ĭreate the bundle jar file by running the following command: jar cvfm manifest.txt junit-4.4.jar.
- Make sure its value matches the filename of the jar that you are going to embed in the bundle.
Bundle-ClassPath header is set to allow embedding the original jar as is.Start by creating a the jar’s manifest file: Manifest-Version: 1.0īundle-Description: Package junit 4.4 in an OSGi bundleĮxport-Package: amework,junit.extensions,org.junit,junit.textui Note: The method below only works in a scenario where the jar file has no dependencies on other external jar files. The example creates an OSGi bundle from the attached junit-4.4.jar. Here’s a very simple way of turning an existing jar file in an OSGi bundle, while keeping control on exported packages. How do I convert an existing jar file into an OSGi bundle? Resolution How to Convert a jar File into an OSGi Bundle Description