java – 安装JDK 9后无法启动Spring Tool Suite

参见英文答案 > Why won’t eclipse oxygen start (for the first time)?                                     3个
>             Neon: how to run on jdk9?                                    9个
我安装了Spring Tool Suite(版本3.9.0).它以前工作得很好.安装JDK 9后,我无法启动Spring Tool Suite.

我可以在错误日志中看到以下内容

java.lang.NoClassDefFoundError: javax/annotation/PreDestroy at
org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450)
at
org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156)
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:178)
at
org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOsgi.dispose(EclipseContextOsgi.java:99)
at
org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOsgi.bundleChanged(EclipseContextOsgi.java:141)
at
org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
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:168)
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.100.v20170421-1418 at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at
org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.base/java.lang.classLoader.loadClass(ClassLoader.java:496)

这个问题真的是因为JDK 9吗?请指出我正确的方向来解决问题.

谢谢.

解决方法

是的,这是由于Java 9. Eclipse中可能存在一个错误修复(见 https://bugs.eclipse.org/bugs/show_bug.cgi?id=525583)但是现在你可以使用一种解决方法:在eclipse.ini中添加–add-modules = ALL-SYstem到启动配置.有关完整示例,请参阅 https://bugs.eclipse.org/bugs/show_bug.cgi?id=493761.

相关文章

Java中的String是不可变对象 在面向对象及函数编程语言中,不...
String, StringBuffer 和 StringBuilder 可变性 String不可变...
序列化:把对象转换为字节序列的过程称为对象的序列化. 反序...
先说结论,是对象!可以继续往下看 数组是不是对象 什么是对...
为什么浮点数 float 或 double 运算的时候会有精度丢失的风险...
面试题引入 这里引申出一个经典问题,看下面代码 Integer a ...