Development: An essay documenting the OSGi jar adds several small problems and places to note

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.