gpt4 book ai didi

java - 在 Java 17 上运行 Eclipse 时出错

转载 作者:行者123 更新时间:2023-12-05 03:37:19 24 4
gpt4 key购买 nike

尝试在 Java 17 JRE 上启动 Eclipse 2021-06 (4.20.0) 时出现错误。

错误显示在对话框和错误日志中:

Screen shot

我该如何解决这个问题?

错误信息的内容是这样的:

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)

最佳答案

我的问题原来是由我使用的 Eclipse 插件引起的,而不是 Eclipse 本身。

插件是这些:

  • Lombok 1.18.20。
  • Eclipse Checkstyle 8.36.1

我的解决方案是使用较旧的 JRE 运行 Eclipse。

原因

这些问题是由于插件使用了从未打算公开的内部 JDK 组件这一事实引起的。作为此更改的一部分,它们已封装在 lasted JDK 中:

https://openjdk.java.net/jeps/403

更新:修复

我欢迎其他解决方案,即使在 Java 17 上也可以使用相同的旧插件继续运行 Eclipse!

关于java - 在 Java 17 上运行 Eclipse 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69373279/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com