解决方案:升级JDK9后eclipse无法启动

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决方案:升级JDK9后eclipse无法启动相关的知识,希望对你有一定的参考价值。

安装JDK9之后,eclipse无法识别javax/annotation/PostConstruct

错误日志workspace/.metadata/.log

  1 !SESSION 2017-10-05 20:04:50.292 -----------------------------------------------
  2 eclipse.buildId=4.7.1.v20170915-1447
  3 java.version=9
  4 java.vendor=Oracle Corporation
  5 BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
  6 Command-line arguments:  -os linux -ws gtk -arch x86_64
  7 
  8 !ENTRY org.eclipse.osgi 4 0 2017-10-05 20:05:25.646
  9 !MESSAGE Application error
 10 !STACK 1
 11 org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
 12     at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410)
 13     at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318)
 14     at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
 15     at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491)
 16     at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505)
 17     at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
 18     at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
 19     at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
 20     at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
 21     at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
 22     at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
 23     at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
 24     at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
 25     at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
 26     at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
 27     at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
 28     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 29     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 30     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 31     at java.base/java.lang.reflect.Method.invoke(Method.java:564)
 32     at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
 33     at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
 34     at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
 35     at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
 36 Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
 37     at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124)
 38     at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399)
 39     ... 23 more
 40 Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.100.v20170915-1447
 41     at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
 42     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
 43     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
 44     at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
 45     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
 46     ... 25 more
 47 
 48 !ENTRY org.eclipse.e4.ui.workbench 4 0 2017-10-05 20:05:25.659
 49 !MESSAGE FrameworkEvent ERROR
 50 !STACK 0
 51 java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
 52     at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450)
 53     at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156)
 54     at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78)
 55     at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111)
 56     at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74)
 57     at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178)
 58     at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:99)
 59     at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:141)
 60     at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
 61     at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
 62     at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
 63     at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213)
 64     at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120)
 65     at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112)
 66     at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168)
 67     at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
 68     at org.eclipse.osgi.container.Module.doStop(Module.java:634)
 69     at org.eclipse.osgi.container.Module.stop(Module.java:498)
 70     at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
 71     at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
 72     at java.base/java.lang.Thread.run(Thread.java:844)
 73 Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.100.v20170915-1447
 74     at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
 75     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
 76     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
 77     at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
 78     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
 79     ... 21 more
 80 !SESSION 2017-10-05 20:06:57.610 -----------------------------------------------
 81 eclipse.buildId=4.7.1.v20170915-1447
 82 java.version=9
 83 java.vendor=Oracle Corporation
 84 BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
 85 Command-line arguments:  -os linux -ws gtk -arch x86_64
 86 
 87 !ENTRY org.eclipse.osgi 4 0 2017-10-05 20:07:04.796
 88 !MESSAGE Application error
 89 !STACK 1
 90 org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
 91     at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410)
 92     at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318)
 93     at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
 94     at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491)
 95     at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505)
 96     at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
 97     at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
 98     at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
 99     at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
100     at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
101     at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
102     at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
103     at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
104     at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
105     at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
106     at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
107     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
108     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
109     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
110     at java.base/java.lang.reflect.Method.invoke(Method.java:564)
111     at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
112     at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
113     at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
114     at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
115 Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
116     at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124)
117     at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399)
118     ... 23 more
119 Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.100.v20170915-1447
120     at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
121     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
122     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
123     at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
124     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
125     ... 25 more
126 
127 !ENTRY org.eclipse.e4.ui.workbench 4 0 2017-10-05 20:07:04.803
128 !MESSAGE FrameworkEvent ERROR
129 !STACK 0
130 java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
131     at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450)
132     at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156)
133     at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78)
134     at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111)
135     at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74)
136     at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178)
137     at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:99)
138     at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:141)
139     at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
140     at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
141     at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
142     at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213)
143     at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120)
144     at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112)
145     at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168)
146     at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
147     at org.eclipse.osgi.container.Module.doStop(Module.java:634)
148     at org.eclipse.osgi.container.Module.stop(Module.java:498)
149     at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
150     at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
151     at java.base/java.lang.Thread.run(Thread.java:844)
152 Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.100.v20170915-1447
153     at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
154     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
155     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
156     at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
157     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
158     ... 21 more

解决方法:

  在eclipse的启动的配置文件eclipse.ini文件末尾添加一行:

--add-modules=ALL-SYSTEM

  注:1.linux下配置文件一般在  /etc/eclipse.ini

    2.普通用户对配置文件只有read only权限,需su

 

以上是关于解决方案:升级JDK9后eclipse无法启动的主要内容,如果未能解决你的问题,请参考以下文章

升级JDK9后eclipse无法启动的解决方法

安装JDK9之后eclipse无法启动问题解决办法

java 1.8下无法启动eclipse

MacOS 系统升级后,提示“应用程序“Eclipse”无法打开。”

关于MacOS升级10.13系统eclipse菜单灰色无法使用解决方案

关于MacOS升级10.13系统eclipse菜单灰色无法使用解决方案