0

I wrote an eclipse plugin which should be executed at startup of workspace (see Executing eclipse plugin automatically). It works perfectly when I try it out with the Run button. But now I created an update site and installed the plugin via the update manager. I don't know why but now it is not executed when eclipse workspace starts.

What could be the problem here?

Content of 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>

I found some additional info in /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.Workbench55ドル.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.Workbench55ドル.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

Why do I get java.lang.NoClassDefFoundError?

asked Feb 10, 2014 at 9:29
5
  • Check that the plugin.xml is included in the code. Commented Feb 10, 2014 at 9:37
  • plugin.xml is included in the project. I have posted its content in my question. Commented Feb 10, 2014 at 12:33
  • 1
    Probabky a dependency is missing. Do you see anything in the workspace/.metadata/log? How about the content of the installed plugin, is it complete? Commented Feb 10, 2014 at 13:10
  • 1
    Most of the time, people lack something in their ´build.properties´ file or defined something in the Run-Configuration instead of a product file. Did you think about using the touch point instruction of a product instead? eclipsesource.com/blogs/2009/06/10/osgi-and-start-levels With definitions in your product, it's harder to miss out on something. Commented Feb 10, 2014 at 13:13
  • It seems that there is really something missing in build-configuration. See the log posted in my question. How do I configure my project correctly for build? Commented Feb 10, 2014 at 13:21

1 Answer 1

2

I found the solution myself. You need to add jars you used in your project to your build configuration (see attached picture).

Build Configuration

answered Feb 10, 2014 at 13:32
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.