ClassNotFoundException when instantiating an eclip

2019-02-28 23:30发布

问题:

I developed an eclipse plugin and I'm trying to install it on another instance of eclipse. When I run/debug my plugin as an eclipse application everything works correctly. The problem occurs only after I install the plugin through the update site I created.

I created a very simple update site which includes a single feature with my plugin packaged in it. After installing using the update site I can see my plugin in the plugin directory under the eclipse install dir and it correctly contains all the data that should be in there (I think). However, when I instantiate the plugin (by hitting the key-binding I defined) I get a ClassNotFoundException for the main plugin class, one that I created and that can be found in the bin directory of my plugin.

It seems that the bin directory is somehow not recognized as a place to search for classes, but I assume that it should be added to the eclipse classpath as part of the plugin installation.

I googled quite a bit about this and found many related problems, none of which was quite hitting my specific situation. I would appreciate any suggestion!

回答1:

When you create a plugin other plugins can only access the classes in packages declared in the Export-Package section of the Manifest.mf. Open the plugin.xml editor and look at the 'Runtime' tab - it needs to have your package listed. Something like this: