Home > OS >  Errors when running Eclipse on Java 17
Errors when running Eclipse on Java 17

Time:09-30

I get errors when I try to start Eclipse 2021-06 (4.20.0) on a Java 17 JRE.

The errors show in a dialog and the Error Log:

Screen shot

How can I fix this?

The contents of the error messages is this:

java.lang.reflect.InaccessibleObjectException: 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 @2bc378f7
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.overrideLoadResult(ModuleClassLoader.java:86)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    at org.eclipse.jdt.internal.compiler.parser.Parser.endParse(Parser.java:11750)
    at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12949)
    at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:13176)
    at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:13133)
    at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:11521)
    at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:850)
    at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:394)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
    at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:377)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:214)
    at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:309)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:79)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:272)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:192)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:846)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:229)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:277)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:330)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:333)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:385)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:406)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:154)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:244)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
java.lang.reflect.InaccessibleObjectException: 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 @2bc378f7
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.overrideLoadResult(ModuleClassLoader.java:86)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    at org.eclipse.jdt.internal.compiler.parser.Parser.endParse(Parser.java:11750)
    at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12949)
    at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:13176)
    at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:13133)
    at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:11521)
    at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:850)
    at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:394)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
    at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:377)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:214)
    at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:309)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:79)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:272)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:187)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:846)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:229)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:277)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:330)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:333)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:385)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:406)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:154)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:244)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
java.lang.reflect.InaccessibleObjectException: Unable to make field private static volatile java.net.Authenticator java.net.Authenticator.theAuthenticator accessible: module java.base does not "opens java.net" to unnamed module @1ab8b487
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
    at net.sf.eclipsecs.core.config.configtypes.RemoteConfigurationType$RemoteConfigAuthenticator.getDefault(RemoteConfigurationType.java:376)
    at net.sf.eclipsecs.core.config.configtypes.RemoteConfigurationType.getCheckstyleConfiguration(RemoteConfigurationType.java:99)
    at net.sf.eclipsecs.core.config.CheckConfiguration.getCheckstyleConfiguration(CheckConfiguration.java:161)
    at net.sf.eclipsecs.core.builder.CheckerFactory.getCacheKey(CheckerFactory.java:157)
    at net.sf.eclipsecs.core.builder.CheckerFactory.createChecker(CheckerFactory.java:99)
    at net.sf.eclipsecs.core.builder.Auditor.runAudit(Auditor.java:139)
    at net.sf.eclipsecs.core.builder.CheckstyleBuilder.handleBuildSelection(CheckstyleBuilder.java:307)
    at net.sf.eclipsecs.core.builder.CheckstyleBuilder.build(CheckstyleBuilder.java:173)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:846)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:229)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:277)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:330)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:333)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:385)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:406)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:154)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:244)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

CodePudding user response:

My problems turned out to be caused by the Eclipse plugins that I was using, not Eclipse itself.

The plugins are these:

  • Lombok 1.18.20.
  • Eclipse Checkstyle 8.36.1

The solution for me is to run Eclipse using an older JRE.

However, I welcome other solutions that makes it possible to continue running Eclipse with the same old plugins even on Java 17!

CodePudding user response:

Is this problem started after installing java-17? Then do this :-

Eclipse 2021-06 does not support java 17 at all. First update your eclipse to Eclipse 2021-09. Then Go to Help -> Eclipse Marketplace and then search for java-17

And after that install the java-17 plugin and restart your ide.

Then close your eclipse and open eclipse.ini file. Then check that path to jdk-17 folder is correct or not. If not hen correct it. Then open eclipse and everything will be working fine.

  • Related