我正在安装Eclipse错误,我收到此错误
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.1.v20160712-0927
...
java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
org.eclipse.osgi.internal.framework.EquinoxBundle $ SystemBundle $ EquinoxSystemModule $ 1.run(EquinoxBundle.java:165)at java.base / java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.1.v20160712-0927
我在系统变量中将“Path”设置为“C:\ Program Files \ Java \ jdk-10.0.1 \ bin; C:\ Program Files \ Java \ jre-10.0.1 \ bin” 和系统变量中的“CLASSPATH”为“C:\ Program Files \ Java \ jdk-10.0.1 \ bin”
答案 0 :(得分:6)
<强>您好,强>
在eclipse.ini
的末尾添加此行--add-modules=java.se.ee
答案 1 :(得分:1)
确保您和Eclipse和JDK的版本都匹配 64位或两者都是32位,然后设置JRE的路径 环境。
答案 2 :(得分:0)
如@RaghuPrasanth V和@nitind所述,请确保您的Eclipse版本正在使用Java的较新版本。
因为我有同样的问题:
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
...
Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418
使用 Java 11
和 Eclipse Java EE IDE for Web Developers. Version: Oxygen Release (4.7.0) Build id: 20170620-1800
要解决此问题,我已重新安装到:
来自here的 Eclipse IDE for Enterprise Java Developers. Version: 2019-03 (4.11.0) Build id: 20190314-1200
。