Eclipse插件未执行

时间:2014-02-10 09:29:45

标签: java eclipse eclipse-plugin

我写了一个eclipse插件,应该在工作区启动时执行(参见Executing eclipse plugin automatically)。当我使用“运行”按钮尝试它时,它完美地工作。但现在我创建了一个更新站点并通过更新管理器安装了该插件。我不知道为什么,但现在它在eclipse工作区启动时没有被执行。

这可能是什么问题?

plugin.xml的内容:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
    <extension point="org.eclipse.ui.startup">
       <startup class="plugin.first.handlers.StartClass"/>
    </extension>
</plugin>

我在/workspace/.metadata/.log中找到了一些其他信息:

!SESSION 2014-02-10 14:17:08.358 -----------------------------------------------
eclipse.buildId=4.3.0.M20130911-1000
java.version=1.7.0_02
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Command-line arguments:  -os win32 -ws win32 -arch x86_64

!ENTRY org.eclipse.ui.workbench 4 2 2014-02-10 14:17:21.380
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".
!STACK 0
java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
    at plugin.first.handlers.ClearFolder.doClear(ClearFolder.java:12)
    at plugin.first.handlers.StartClass.earlyStartup(StartClass.java:15)
    at org.eclipse.ui.internal.EarlyStartupRunnable.runEarlyStartup(EarlyStartupRunnable.java:87)
    at org.eclipse.ui.internal.EarlyStartupRunnable.run(EarlyStartupRunnable.java:66)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.Workbench$55.run(Workbench.java:2551)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils cannot be found by plugin.clearsvnauth_1.0.0.201402101022
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more

!ENTRY org.eclipse.ui 4 4 2014-02-10 14:17:21.393
!MESSAGE Unhandled Exception

!ENTRY plugin.clearsvnauth 4 0 2014-02-10 14:17:21.394
!MESSAGE Unable to execute early startup code for an extension
!STACK 0
java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
    at plugin.first.handlers.ClearFolder.doClear(ClearFolder.java:12)
    at plugin.first.handlers.StartClass.earlyStartup(StartClass.java:15)
    at org.eclipse.ui.internal.EarlyStartupRunnable.runEarlyStartup(EarlyStartupRunnable.java:87)
    at org.eclipse.ui.internal.EarlyStartupRunnable.run(EarlyStartupRunnable.java:66)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.Workbench$55.run(Workbench.java:2551)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils cannot be found by plugin.clearsvnauth_1.0.0.201402101022
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more

为什么我会获得java.lang.NoClassDefFoundError

1 个答案:

答案 0 :(得分:2)

我自己找到了解决方案。您需要将项目中使用的jar添加到构建配置中(参见附图)。

Build Configuration