[英]Eclipse plugin cannot find class from class folder
I'm developing an Eclipse plugin, and want to use some pre-compiled classes which I've put to lib/
folder in my project (so the directory structure looks like {proj_root}/lib/com/example/Required.class
). 我正在开发一个Eclipse插件,并希望使用一些预先编译的类,我已经将这些类放到我的项目中的
lib/
文件夹中(所以目录结构看起来像{proj_root}/lib/com/example/Required.class
) 。 Then I've added lib/
folder as class folder to project's build path. 然后我将
lib/
文件夹作为类文件夹添加到项目的构建路径中。 At build time all is working fine, I can import and use that classes in my code. 在构建时,一切正常,我可以在我的代码中导入和使用这些类。 And now the problem is, when I'm running my plugin in separate Eclipse instance I get
ClassNotFoundException
by my plugin refering to class from precompiled classes folder. 现在的问题是,当我在单独的Eclipse实例中运行我的插件时,我的插件引用了
ClassNotFoundException
,引用了precompiled classes文件夹中的类。
I tried specifying my class folder in "Order and export" tab in Build path settings. 我尝试在构建路径设置的“订购和导出”选项卡中指定我的类文件夹。 Also I tried setting checkbox in plugin's build.properties GUI editor in front of
lib/
folder to be included in binary build. 此外,我尝试在
lib/
文件夹前面的插件的build.properties GUI编辑器中设置复选框,以包含在二进制构建中。 In that case if I export my plugin to JAR I can see lib/
folder inside it, with my classfiles, but at runtime my plugin still cannot find any of classes from lib/
. 在这种情况下,如果我将我的插件导出到JAR,我可以使用我的类文件在其中看到
lib/
文件夹,但在运行时我的插件仍然无法从lib/
找到任何类。
The class folder 'lib/' is not associated to any output library entry.
The class folder 'lib/' is not associated to any output library entry.
and suggests to make this modification of code: output.. = bin/,lib/
. output.. = bin/,lib/
。 I have tried that solution but it is seems to change nothing with the problem. It sounds very much like you have added the lib
folder to the "Java Build Path" properties page of the plug-in project. 这听起来非常像您已将
lib
文件夹添加到插件项目的“Java Build Path”属性页面。
But... for plug-in projects, this does not work as these are OSGi bundles - you must include the lib
folder in the PDE Editor on the "Runtime" page: 但是......对于插件项目,这不起作用,因为这些是OSGi包 - 您必须在“运行时”页面的PDE编辑器中包含
lib
文件夹:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.