Search code examples
javaeclipseeclipse-neon

Eclipse Neon will not run


I click on eclipse.exe and a box comes up that says "An error has occurred: see the log file C:\Users\sam\workspace\.metadata\.log". I searched on this error message and found lots of people with the same issue (including this, this, and this, and lots of others) but none of the solutions in any answers worked for me, not even a change in the error message. I then searched on the specific error in the log file, which is:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2019-06-27 12:56:35.009
!MESSAGE FrameworkEvent ERROR
!STACK 0
java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
    at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:426)
    at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:154)
    at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78)
    at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111)
    at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74)
    at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:176)
    at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:106)
    at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:139)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:903)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:156)
    at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
    at org.eclipse.osgi.container.Module.doStop(Module.java:634)
    at org.eclipse.osgi.container.Module.stop(Module.java:498)
    at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
    at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
    at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.1.v20160712-0927
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:410)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:372)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
    ... 21 more

and found some other things that didn't work.

Here are some of the things I tried:

  • Deleting and reinstalling Eclipse
  • Going to the command line and running eclipse with eclipse.exe -clean, eclipse.exe -clean --launcher.ini (path to eclipse.ini), and eclipse.exe -clean --clearPersistedState - None changed the outcome
  • Deleting the entire .metadata folder, the entire workspace folder, and the contents of the .plugins folder.
  • Altering the eclipse.ini file in various ways, including putting .clean at the top, replacing -vmargs with -vm and the path to javaw.exe. nothing worked, or even changed anything
  • running eclipse as administrator (i.e. I am desperate)

I have Windows 10 64-bit, Eclipse Neon 3 64-bit, java is in my PATH, and this is what comes up when I type java -version:

java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

I hesitated to ask this question on SO, but I think something might have changed in the time since it was last asked. None of those solutions worked for me, and I have no other option at this point.


Solution

  • As was mentioned by greg-449 in a comment, you can't use Java 10 with Neon.

    There's a compatibility chart on the eclipse wiki that specifies what versions of Java are required for a given version of eclipse.

    You'll notice that in the entry for Eclipse 4.6 (Neon) it specifies that "A Java 8 JRE/JDK is required..." as opposed to version 4.7 and higher, which need "A Java 8 or newer JRE/JDK..."

    This is further clarified in the Install a JVM section, which has a warning that

    If using Java 9 or newer please use Eclipse 4.7.1a or newer as it contains fixes in Eclipse launcher to add all JVM modules.