简体   繁体   English

Eclipse 插件项目和用户库

[英]Eclipse plugin project and user library

I tried to add my own User Library to my eclipse plugin project.我试图将我自己的用户库添加到我的 eclipse 插件项目中。 But when I run the project, I get the java.lang.ClassNotFoundException .但是当我运行这个项目时,我得到了java.lang.ClassNotFoundException It only works, when I add single jars like mentioned in the accepted answer to this question: Adding jars to a Eclipse PlugIn它仅适用,当我添加一个罐子像在接受这个问题的答案中提到: 添加罐子到Eclipse插件

How do I use custom User Libraries correctly in eclipse plugin projects?如何在 eclipse 插件项目中正确使用自定义用户库?

You don't.你没有。 Your plug-in executes in the plug-in runtime, which means all of its dependencies have to be stated in its manifest or delivered as part of that plug-in.您的插件在插件运行时中执行,这意味着它的所有依赖项都必须在其清单中声明或作为该插件的一部分交付。 You'll have to place whatever jars make up the user library into the project itself and add them to the runtime section of your manifest.您必须将构成用户库的任何 jar 文件放入项目本身,并将它们添加到清单的运行时部分。

插件清单编辑器的运行时选项卡

Don't edit the Java Build Path manually.不要手动编辑 Java 构建路径。 PDE will change it so that it keeps up with the manifest's contents, but that only goes one-way. PDE 将更改它以使其与清单的内容保持一致,但这只是一种方式。

I generally do it by我通常这样做

1. Open your plugin.xml
2. Go to Runtime tab and add your JAR in the classpath section
3. Also you have to add the plugin dependencies

http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.pde.doc.user/guide/tools/editors/manifest_editor/dependencies.htm http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.pde.doc.user/guide/tools/editors/manifest_editor/dependencies.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM