Reputation: 644
I am installing Eclipse error and I am getting this error
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
I have set "Path" in System variables as "C:\Program Files\Java\jdk-10.0.1\bin;C:\Program Files\Java\jre-10.0.1\bin" and "CLASSPATH" in System Variables as "C:\Program Files\Java\jdk-10.0.1\bin"
Upvotes: 8
Views: 10778
Reputation: 6500
As mentioned @RaghuPrasanth V and @nitind, be sure that your version of Eclipse is working with newer versions of Java.
Because I had the same issue:
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
using Java 11
and Eclipse Java EE IDE for Web Developers. Version: Oxygen Release (4.7.0) Build id: 20170620-1800
And to solve it, I have re-installed to:
Eclipse IDE for Enterprise Java Developers. Version: 2019-03 (4.11.0) Build id: 20190314-1200
from here.
Upvotes: 2
Reputation: 194
Hi,
Add this lines at end of your eclipse.ini
--add-modules=java.se.ee
Upvotes: 9
Reputation: 194
Make sure that you're version of Eclipse and JDK match, either both 64-bit or both 32-bit, then set the path of the JRE in the environment .
Upvotes: 4