解決Eclipse啟動報缺少javax/annotation/PostConstruct的錯誤
版權宣告:本文為博主chszs的原創文章,未經博主允許不得轉載。 https://blog.csdn.net/chszs/article/details/78178158
解決Eclipse啟動報缺少javax/annotation/PostConstruct的錯誤
- 版權宣告:本文為博主chszs的原創文章,未經博主允許不得轉載。
我使用的是Mac開發環境,Eclipse使用4.7的Oxygen版。
當我在本機上安裝了Java 9後,我發現Eclipse無法啟動了。
開啟Eclipse的日誌檔案(我的在這裡Users/XXXXX/Documents/eclipsework/.metadata/.log)
可以看到有如下錯誤輸出:
!SESSION 2017-10-08 22:04:45.234 -----------------------------------------------
eclipse.buildId=4.7.0.I20170612-0950
java.version=9
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=zh_CN
Framework arguments: -product org.eclipse.epp.package.jee.product -keyring /Users/liqiang/.eclipse_keyring
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.jee.product -keyring /Users/liqiang/.eclipse_keyring
!ENTRY org.eclipse.osgi 4 0 2017-10-08 22:04:47.669
!MESSAGE Application error
!STACK 1
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399)
... 22 more
Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct 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)
... 24 more
這個錯誤是安裝了Java 9環境後導致的,即使解除安裝了Java 9,回退到Java 8,仍然有這個問題。
要解決這個問題並不難,開啟Finder,選擇“應用程式”,找到Eclipse,滑鼠右鍵點選圖示,選擇“顯示包內容”,開啟“Contents”–>“Eclipse”,找到檔案“eclipse.ini”
編輯這個檔案,在末尾加上一句:
--add-modules=ALL-SYSTEM
儲存,並退出Finder,重啟Eclipse即可恢復正常。
相關文章
- 語法錯誤 : 缺少“;”(在“型別”的前面)的解決方案型別
- Eclipse 啟動專案錯誤:class not foundEclipse
- 啟動Eclipse彈出:Failed to load JavaHL Library 錯誤框的解決辦法EclipseAIJava
- SAP BTP Kyma Runtime dashboard 開啟報缺少缺陷的錯誤訊息該如何解決
- ubuntu網路卡啟動錯誤解決方法Ubuntu
- vmware server啟動時503錯誤解決Server
- zabbix-server啟動報錯解決Server
- 解決eclipse的maven依賴報錯EclipseMaven
- tomcat啟動超時以及啟動之後開啟網頁報404錯誤的解決方法Tomcat網頁
- 解決報錯error the @annotation pointcut expression is only supported at Java 5ErrorExpressJava
- JDeveloper啟動時老是報錯-解決方法Developer
- MySQL 啟動服務報錯解決方案MySql
- 解決 Rust WebAssembly 啟動 Web 程式報錯RustWeb
- IDEA啟動時報Failed to create JVM錯誤的解決IdeaAIJVM
- 解決Eclipse裡Maven工程報 An error occurred while filtering resources錯誤EclipseMavenErrorWhileFilter
- 解決MMM啟動監控報錯的問題
- Unity3D啟動報錯的解決方案Unity3D
- Apache Hive啟動報NoClassDefFoundError錯誤ApacheHiveError
- Qt報Multiple definition錯誤的解決QT
- nested exception is javax.validation.ValidationException錯誤解決思路ExceptionJava
- 啟動 Eclipse 彈出“Failed to load the JNI shared library jvm.dll”錯誤的解決方法!EclipseAIJVM
- keepalived啟動報錯解決一例
- tomcat5啟動NotSerializableException報錯解決TomcatException
- dbua後資料庫無法啟動錯誤的解決資料庫
- dbfread報錯ValueError錯誤解決方法Error
- Eclipse中解決Multiple annotations found at this line錯誤。Eclipse
- 【eclipse】 怎麼解決java.lang.NoClassDefFoundError錯誤EclipseJavaError
- 【轉】啟動 Eclipse 彈出“Failed to load the JNI shared library jvm.dll”錯誤的解決方法!...EclipseAIJVM
- 解決MySQL啟動時萬惡的1067錯誤(轉)MySql
- VMware 啟動報錯 "Failed to lock the file"解決辦法AI
- 解決MySQL啟動時萬惡的的“1067”錯誤(轉)MySql
- MYSQL啟動後報:ERROR! The server quit without updating PID file錯誤的問題解決MySqlErrorServerUI
- service mysql start出錯,mysql啟動不了,解決mysql: unrecognized service錯誤MySqlZed
- eclipse: workspace出錯導致無法啟用的解決Eclipse
- 時區錯誤導致oracle的EM不能啟動解決辦法Oracle
- 解決docker啟動映象報錯:docker: Error response from daemonDockerError
- VirtualBox-4.3.0啟動報錯及解決辦法
- ghost win10啟動出現錯誤怎麼解決_ghost win10啟動出現錯誤如何修復Win10