Copyright © 2009, 2010, 2011, 2012, 2013, 2014 vogella GmbH
Table of Contents
If a JAR file does not contain the OSGi meta-data in the
file, it cannot be directly consumed by other Eclipse plug-ins.
If you want to use such standard Java libraries in other Eclipse plug-ins you have to convert them also into a plug-in. After the conversion the resulting JAR file can still be used in a non OSGi runtime, e.g., a Java webserver. The Java runtime ignores the additional OSGi meta-data.
Eclipse provides a wizard to convert a JAR file with OSGi meta-data to a plug-in. The usage of this wizard is demonstrated in Section 2, “Integrating external jars / third party libraries”.
If you repackage a JAR into a plug-in it is wise to check if the license allows this. You should also try to contact the author of the software and ask if he can integrate the OSGi meta-data directly in his library.
The following gives an example how to convert a standard Java JAR to an Eclipse plug-in.
Create a new plug-in project by selecting→ → → → .
Add the JAR files you want to have in this new plug-in. Press next.
Enter a name and a version for your new plug-in. Uncheck the Unzip the JAR archive into the project flag. Unchecking this flag prevents that the class files are extracted from the JAR file which is not necessary to use them.
Afterwards press thebutton in the wizard.
You have created a new plug-in for the selected JAR files. Open
and validate that all required packages are exported on
Runtime. All the packages from your JAR files
packages as OSGi will otherwise prevent
Writing and updating these tutorials is a lot of work. If this free community service was helpful, you can support the cause by giving a tip as well as reporting typos and factual errors.
If you find errors in this tutorial, please notify me (see the top of the page). Please note that due to the high volume of feedback I receive, I cannot answer questions to your implementation. Ensure you have read the vogella FAQ as I don't respond to questions already answered there.
|TRAINING||SERVICE & SUPPORT|
|The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.||The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.|