Upgrading to the last Eclipse version, now I am getting the following error:
Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @5d01b0d8
I tried changing JDK under preferences with no luck.
Since Eclipse 2021-09 does not support Java 17, I guess you have installed Java 17 Support for Eclipse 2021-09 (4.21) which is the preview/BETA of the upcoming Java 17 support that will be released with Eclipse 2021-12 (4.22) on December 15, 2021.
This issue of mine is only with the JVM used to run Eclipse. An increasing number of platform plugins have moved to Java 11, so the Eclipse IDE is now unusable with a Java 8 JVM. You may however still use the IDE to develop Java 8 and indeed Java 5 applications.
An easy way is to change the Java Version used to run Eclipse. There for you have to change the eclipse.ini. Set the vm location at the start of the file to a prior Java 16 JDK e.g. JDK 14 Under MacOSX eclipse.ini is typically located in /Applications/Eclipse.app/Contents/Eclipse/
If you are using Lombok, it's probably this issue: twitter.com/howlger/status/1407316561803763716 (changing the JDK under preferences, does not change the Java used to run Eclipse). Or a similar issue of a plugin you have installed. Thanks, @howlger it was Lombok plug-in when using JDK 16.
Thanks, @howlger it was Lombok plug-in when using JDK 16. That tweet gave me the reasons: https://github.com/projectlombok/lombok/issues/2810
A workaround :
--illegal-access=warn
and --add-opens java.base/java.lang=ALL-UNNAMED
to your eclipse.iniIn my situation I had to change eclipse.ini VM path:
-vm
C:\bin\jdk-15.0.2\bin
An easy way is to change the Java Version used to run Eclipse. There for you have to change the eclipse.ini.
This a working example of the eclipse.ini file:
-vm
/Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home/bin/java
-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.6.200.v20210416-2027.jar
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.2.200.v20210527-0259
-product
org.eclipse.epp.package.java.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-javaagent:/Applications/Eclipse.app/Contents/Eclipse/lombok.jar
-Dosgi.requiredJavaVersion=11
[email protected]/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Xms256m
-Xmx2048m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With