Eclipse Neon 不会 运行

Eclipse Neon will not run

我点击 eclipse.exe,出现一个框,上面写着 "An error has occurred: see the log file C:\Users\sam\workspace\.metadata\.log"。我搜索了这条错误消息,发现很多人都有同样的问题(包括 this, this, and this,还有很多其他人),但是任何答案中的 none 解决方案都对我有用,甚至没有改变错误信息。然后我在日志文件中搜索了具体错误,即:

!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.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

并发现了其他一些不起作用的东西。

以下是我尝试过的一些方法:

我有 Windows 10 64 位,Eclipse Neon 3 64 位,java 在我的路径中,这就是我键入 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)

我对在 SO 上问这个问题犹豫不决,但我认为自从上次被问到以来,某些事情可能已经发生了变化。 None 这些解决方案对我有用,目前我别无选择。

正如 greg-449 在评论中提到的,您不能将 Java 10 与 Neon 一起使用。

eclipse wiki 上有一个 compatibility chart 指定给定版本的 eclipse 需要哪些 Java 版本。

您会注意到在 Eclipse 4.6 (Neon) it specifies that "A Java 8 JRE/JDK is required..." as opposed to version 4.7 及更高版本的条目中,需要 "A Java 8 or newer JRE/JDK..."

Install a JVM 部分对此进行了进一步说明,其中有一个警告

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.