实例化 Eclipse 插件时出现 ClassNotFoundException

我开发了一个 Eclipse 插件,我正在尝试将它安装在另一个 Eclipse 实例上.当我将插件作为 Eclipse 应用程序运行/调试时,一切正常.只有在我通过我创建的更新站点安装插件后才会出现此问题.

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.

我创建了一个非常简单的更新站点,其中包含一个功能,其中包含我的插件.使用更新站点安装后,我可以在 eclipse 安装目录下的 plugin 目录中看到我的插件,它正确包含应该在那里的所有数据(我认为).但是,当我实例化插件时(通过点击我定义的键绑定),我得到了主插件类的 ClassNotFoundException,这是我创建的,可以在我的插件的 bin 目录中找到.

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.

似乎 bin 目录不知何故未被识别为搜索类的地方,但我认为它应该作为插件安装的一部分添加到 eclipse 类路径中.

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!

推荐答案

当您创建插件时,其他插件只能访问在 Manifest.mf 的 Export-Package 部分中声明的包中的类.打开 plugin.xml 编辑器并查看运行时"选项卡 - 它需要列出您的包.像这样的:

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:

相关文章