Posted by: Brian de Alwis | March 10, 2011

On the perils of creating plugins from jars

Eclipse JDT/PDE has a handy feature where you can make a plugin/bundle from an existing JAR. (File -> New -> PDE -> Create plugin from Jar). This might seem to be a brilliant feature, but it has a downside in that Eclipse JDT doesn’t check dependencies of the resulting class files.

This bit me recently when making a bundle from the JUNG libraries. Fortunately Peter Krien’s bnd does a great job (instructions), and there’s now some nice-looking tooling too.

BundleLoader[edu.uci.lcs.jung.algorithms_2.0.0].loadBundleClass(edu.uci.ics.jung.graph.Hypergraph)
BundleLoader[edu.uci.lcs.jung.algorithms_2.0.0].findLocalClass(edu.uci.ics.jung.graph.Hypergraph)
BundleClassLoader[/usr/local/installs/eclipse-R3.5.1/plugins/edu.uci.lcs.jung.algorithms_2.0.0.jar].findClass(edu.uci.ics.jung.graph.Hypergraph)
BundleClassLoader[edu.uci.lcs.jung.algorithms_2.0.0].loadClass(edu.uci.ics.jung.graph.Hypergraph) failed.
java.lang.ClassNotFoundException: edu.uci.ics.jung.graph.Hypergraph

Ouch.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories