执行 Minecraft mod 时线程“主”java.lang.ExceptionInInitializerError 中的错误异常

问题描述 投票:0回答:1

所以,我正在关注 1.16 中的 Minecraft 改装教程,我使用 Eclipse 和 1.16.4 mdk,一切都很顺利,直到我尝试启动游戏,它一直出现错误,这是控制台:

2023-04-25 18:39:51,378 main WARN Advanced terminal features are not available in this environment
[18:39:51] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmluserdevclient, --fml.mcpVersion, 20201102.104115, --fml.mcVersion, 1.16.4, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 35.1.4, --version, MOD_DEV, --assetIndex, 1.16, --assetsDir, C:\Users\codic\.gradle\caches\forge_gradle\assets, --username, Dev, --accessToken, ❄❄❄❄❄❄❄❄, --userProperties, {}]
[18:39:51] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 8.0.6+85+master.325de55 starting: java version 17.0.6 by Eclipse Adoptium
[18:39:51] [main/DEBUG] [cp.mo.mo.LaunchServiceHandler/MODLAUNCHER]: Found launch services [minecraft,fmldevdata,fmldevclient,fmldevserver,fmluserdevserver,fmluserdevdata,testharness,fmlclient,fmluserdevclient,fmlserver]
Exception in thread "main" java.lang.ExceptionInInitializerError
    at cpw.mods.modlauncher.Launcher.lambda$new$6(Launcher.java:55)
    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
    at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:52)
    at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:47)
    at cpw.mods.modlauncher.Environment.computePropertyIfAbsent(Environment.java:62)
    at cpw.mods.modlauncher.Launcher.<init>(Launcher.java:55)
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.jar.JarVerifier java.util.jar.Manifest.jv accessible: module java.base does not "opens java.util.jar" to unnamed module @5f683daf
    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 cpw.mods.modlauncher.SecureJarHandler.<clinit>(SecureJarHandler.java:48)
    ... 8 more

我尝试使用 ChatGPT 来修复它,但它说这是一个 Java 兼容性问题,我检查了几次后不是,版本是正确的,JRE 1.8.

java eclipse minecraft-forge mod
1个回答
0
投票

java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.jar.JarVerifier java.util.jar.Manifest.jv accessible: module java.base does not "opens java.util.jar" to unnamed module @5f683daf

版本对,JRE 1.8.

你的那一行错误意味着你实际上没有使用 JRE 1.8。模块和开放在当时甚至不作为概念存在。如果您真的切换到 JRE 1.8,那么该错误就会消失。

© www.soinside.com 2019 - 2024. All rights reserved.