Eclipse报错:javax/annotation/PreDestroy
把jdk8卸载后,装了jdk10,设置好环境变量,并测试安装成功后,重启了eclipse,结果报错了。
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 C o n t e x t I n j e c t i o n L i s t e n e r . u p d a t e ( C o n t e x t O b j e c t S u p p l i e r . j a v a : 78 ) a t o r g . e c l i p s e . e 4. c o r e . i n t e r n a l . c o n t e x t s . T r a c k a b l e C o m p u t a t i o n E x t . u p d a t e ( T r a c k a b l e C o m p u t a t i o n E x t . j a v a : 111 ) a t o r g . e c l i p s e . e 4. c o r e . i n t e r n a l . c o n t e x t s . T r a c k a b l e C o m p u t a t i o n E x t . h a n d l e I n v a l i d ( T r a c k a b l e C o m p u t a t i o n E x t . j a v a : 74 ) a t o r g . e c l i p s e . e 4. c o r e . i n t e r n a l . c o n t e x t s . E c l i p s e C o n t e x t . d i s p o s e ( E c l i p s e C o n t e x t . j a v a : 176 ) a t o r g . e c l i p s e . e 4. c o r e . i n t e r n a l . c o n t e x t s . o s g i . E c l i p s e C o n t e x t O S G i . d i s p o s e ( E c l i p s e C o n t e x t O S G i . j a v a : 106 ) a t o r g . e c l i p s e . e 4. c o r e . i n t e r n a l . c o n t e x t s . o s g i . E c l i p s e C o n t e x t O S G i . b u n d l e C h a n g e d ( E c l i p s e C o n t e x t O S G i . j a v a : 139 ) a t o r g . e c l i p s e . o s g i . i n t e r n a l . f r a m e w o r k . B u n d l e C o n t e x t I m p l . d i s p a t c h E v e n t ( B u n d l e C o n t e x t I m p l . j a v a : 903 ) a t o r g . e c l i p s e . o s g i . f r a m e w o r k . e v e n t m g r . E v e n t M a n a g e r . d i s p a t c h E v e n t ( E v e n t M a n a g e r . j a v a : 230 ) a t o r g . e c l i p s e . o s g i . f r a m e w o r k . e v e n t m g r . L i s t e n e r Q u e u e . d i s p a t c h E v e n t S y n c h r o n o u s ( L i s t e n e r Q u e u e . j a v a : 148 ) a t o r g . e c l i p s e . o s g i . i n t e r n a l . f r a m e w o r k . E q u i n o x E v e n t P u b l i s h e r . p u b l i s h B u n d l e E v e n t P r i v i l e g e d ( E q u i n o x E v e n t P u b l i s h e r . j a v a : 213 ) a t o r g . e c l i p s e . o s g i . i n t e r n a l . f r a m e w o r k . E q u i n o x E v e n t P u b l i s h e r . p u b l i s h B u n d l e E v e n t ( E q u i n o x E v e n t P u b l i s h e r . j a v a : 120 ) a t o r g . e c l i p s e . o s g i . i n t e r n a l . f r a m e w o r k . E q u i n o x E v e n t P u b l i s h e r . p u b l i s h B u n d l e E v e n t ( E q u i n o x E v e n t P u b l i s h e r . j a v a : 112 ) a t o r g . e c l i p s e . o s g i . i n t e r n a l . f r a m e w o r k . E q u i n o x C o n t a i n e r A d a p t o r . p u b l i s h M o d u l e E v e n t ( E q u i n o x C o n t a i n e r A d a p t o r . j a v a : 156 ) a t o r g . e c l i p s e . o s g i . c o n t a i n e r . M o d u l e . p u b l i s h E v e n t ( M o d u l e . j a v a : 476 ) a t o r g . e c l i p s e . o s g i . c o n t a i n e r . M o d u l e . d o S t o p ( M o d u l e . j a v a : 634 ) a t o r g . e c l i p s e . o s g i . c o n t a i n e r . M o d u l e . s t o p ( M o d u l e . j a v a : 498 ) a t o r g . e c l i p s e . o s g i . c o n t a i n e r . S y s t e m M o d u l e . s t o p ( S y s t e m M o d u l e . j a v a : 202 ) a t o r g . e c l i p s e . o s g i . i n t e r n a l . f r a m e w o r k . E q u i n o x B u n d l e 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 ContextInjectionListener.update(ContextObjectSupplier.java:78)atorg.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111)atorg.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74)atorg.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:176)atorg.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:106)atorg.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:139)atorg.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:903)atorg.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)atorg.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)atorg.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213)atorg.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120)atorg.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112)atorg.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:156)atorg.eclipse.osgi.container.Module.publishEvent(Module.java:476)atorg.eclipse.osgi.container.Module.doStop(Module.java:634)atorg.eclipse.osgi.container.Module.stop(Module.java:498)atorg.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)atorg.eclipse.osgi.internal.framework.EquinoxBundleSystemBundle$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
解决方法是(显示问题,add前面是两个 - 不是一个)
eclipse.ini文件中最后加入以下内容
–add-modules=ALL-SYSTEM