Runtime issues during developing an Eclipse Plugin

By : moses

Right now, I am trying to create a plug-in of Eclipse which depends on other jar; therefore, I created a plug-in base on the jar and deployed it under my Eclipses' plugin foler. It works well when I start it from my working environment via an Eclipse. However, as soon as I have exported it into a jar and have deployed into Eclipse, it not work any more as it couldn't find out the dependent jar. What happened and how to solve the issue? Does anyone know that? please save me.

By : moses

The MANIFEST.MF has a Tab called "Dependencies" in which alle plugins should placed the current plugin depends on. At runtime you have to place the "dependencies" plugins in the same folder as the one you want to start or you want to work with.

When a plugin has jars it should use, you have to put the jars to the "Runtime" Classpath Entry and you should add the jar to the "Build" Binary Build entry.

Also, does the plugin.xml associated with your 'external jar' plugin does export the right packages ?

Did you check this article describing all steps necessary to packaging 3rd party jars as plug-ins ?

Other very important points are described in the article PDE and 3rdParty Bundles in OSGI Enterprise apps with rules such as:

  • Always put dependent JAR Files in separate bundles and describe the dependencies in your Manifest file. Don't hide those JARs in your own bundle.

  • If possible use Import-Package to resolve your dependencies.

  • Export only your "public" packages - no internal.

  • Use Require-Bundle only to resolve dependencies inside your own „universe“, not against common bundles.

  • Always version Require-Bundle, Import-Package und Export-Package.
    Require-Bundle always has a dependency to a bundle with a specific name.
    Import-Package isn't dependent from the name of the bundle, so its more flexible. Of course its more work to look at your packages and decide which you need to import or to export compared to a one-liner with Require-Bundle

  • If a bundle itself contains packages inside the bundle and exports them, never put these packages also into the Manifest as imported packages.

  • Before deploying of a bundle as plug-in be sure the Package-Uses are re-calculated. Wrong Package-Use entries for exported packages can stop PDE to export your Plug-In.

By : VonC

The working behavior out of Eclipse is normal, since the dependent jar is in the classpath of the project.

Have you had a look at the plugin folder you deployed? I suspect, that the dependency isn't contained in the plugin folder.

By : boutta

This video can help you solving your question :)
By: admin