When referencing a jar package, if it is a package referenced in the project, it needs to be MANIFEST. MF Inside definition
One, external jar:
For example: The external package reference needs to be defined in the import packages, such as: Google-gson-2.2.2.jar I need to reference this external package,
need to add a line in the import package: com.google.gson;version= "2.2.2", here is a noteworthy place, as follows (this is collected online, specifically I did not practice):
Bundlea:
Import-package:org.yj;version= "1.0.0", which means that as long as the org.yj version of bundle B is not less than 1.0.0 can be reslove successful, can import to.
Bundlea:
Import-package:org.yj;version= "[1.0.0,1.0.0]", so to write, means that only matching version= "1.0.0" can resovle success.
Second, put the jar under Lib:
Put the jar under Lib. At this time, you need to add a reference to the Lib package in the MANIFEST.MF Bundle-classpath, such as:
Lib/google-gson-2.2.2.jar No, you don't have to define it in the import package.
Third, if the above are configured, also reported out the jar package is not referenced or classnotfound
At this point, you can try adding a jar package under bundles and adding the jar's boot in Config.ini
Development: An essay documenting the OSGi jar adds several small problems and places to note