ClassNotFoundException when instantiating an eclipse plugin

▼魔方 西西 提交于 2020-01-11 11:33:11

问题


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:



来源:https://stackoverflow.com/questions/18644482/classnotfoundexception-when-instantiating-an-eclipse-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!