RSS

Search Engine

Saturday, June 19, 2010

Integrating external jars / third party libraries

The following gives an example how to convert jars to Eclipse plugins.

1.1. Create a plugin project for your jar

Create a new Plugin project by selection File-> New -> Project...-> Plug-in Development -> "Plug-in from Existing JAR Archives"

Add the jars you want to have in this new plugin. Press next.

Maintain a name and a version for this plugin. Uncheck the flag "Unzip the JAR archive into the project". Press then finish. Unchecking the flag "Unzip the JAR archive into the project" prevents that the class files are extracted from the Jar which is usually not necessary.

You have now bundled your jars into a new plugin. Open the file "MANIFEST.MF" and validate that all required package are exported on the tab "Runtime". All the packages from your jars should be included in the exported packages as OSGi will otherwise present other plugins from accessing them.

1.2. Using the new plugin project

In the plugin project which should use the library, select now select your plugin.xml and the tab dependencies. Under required Plug-ins press add and add your generated plugin as a dependency to your RCP application. This will make the classes from the jar available to your plugin.

0 comments:

Post a Comment