繁体   English   中英

“警告:发生了非法反射访问操作”,安装了 JDK 8

[英]“WARNING: An illegal reflective access operation has occurred” with JDK 8 installed

我刚买了一台新电脑,并决定开始涉足创建我的世界模组。 超级新,不知道我在做什么,按照我 go 的指南。

I've downloaded Open JDK 8, downloaded eclipse, downloaded and unzipped the forge JDK kit, imported the project as an existing gradle project, ran the genEclipseRuns gradle task, imported the launch configs of runClient and runServer, made sure I was running the right环境中的 Minecraft 版本,go 运行项目,我总是收到以下错误。

2021-01-05 20:37:26,828 main WARN Advanced terminal features are not available in this environment
[20:37:26] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmluserdevserver, --fml.mcpVersion, 20201102.104115, --fml.mcVersion, 1.16.4, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 35.1.4]
[20:37:26] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 8.0.6+85+master.325de55 starting: java version 15.0.1 by Oracle Corporation
[20:37:27] [main/DEBUG] [cp.mo.mo.LaunchServiceHandler/MODLAUNCHER]: Found launch services [minecraft,fmldevdata,fmldevclient,fmldevserver,fmluserdevserver,fmluserdevdata,testharness,fmlclient,fmluserdevclient,fmlserver]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by cpw.mods.modlauncher.SecureJarHandler (file:/C:/Users/Shelby/.gradle/caches/modules-2/files-2.1/cpw.mods/modlauncher/8.0.6/70155a85837ebb17d36815ab4d12a3b464963df8/modlauncher-8.0.6.jar) to field java.util.jar.Manifest.jv
WARNING: Please consider reporting this to the maintainers of cpw.mods.modlauncher.SecureJarHandler
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[20:37:27] [main/DEBUG] [cp.mo.mo.NameMappingServiceHandler/MODLAUNCHER]: Found naming services : [srgtomcp]
[20:37:27] [main/DEBUG] [cp.mo.mo.LaunchPluginHandler/MODLAUNCHER]: Found launch plugins: [mixin,eventbus,object_holder_definalize,runtime_enum_extender,capability_inject_definalize,accesstransformer,runtimedistcleaner]
[20:37:27] [main/DEBUG] [cp.mo.mo.TransformationServicesHandler/MODLAUNCHER]: Discovering transformation services
...

此外,还有这个错误:

...
[20:37:28] [main/DEBUG] [ne.mi.fm.lo.ModSorter/LOADING]: Found 2 mandatory requirements
[20:37:28] [main/DEBUG] [ne.mi.fm.lo.ModSorter/LOADING]: Found 0 mandatory mod requirements missing
Exception in thread "main" [20:37:28] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: java.lang.NoClassDefFoundError: jdk/nashorn/api/scripting/NashornScriptEngineFactory
[20:37:28] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]:   at net.minecraftforge.coremod.CoreModEngine.loadCoreMod(CoreModEngine.java:48)
[20:37:28] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]:   at net.minecraftforge.coremod.CoreModProvider.addCoreMod(CoreModProvider.java:12)
[20:37:28] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]:   at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
...

在过去的一个小时里,我一直在努力让它工作,我已经卸载了所有东西,重新安装了所有东西,重新启动了我的计算机,手动删除了更改启动配置的 JDK 环境,我能想到的任何事情。

我发现谷歌上的所有其他实例都说我不需要以后安装 JDK,我必须有 JDK 8,但我从来没有其他版本。

非常感激任何的帮助。

免责声明:我不熟悉 Minecraft 的开发模式。 为了提供帮助,我纯粹从 Java 开发的角度来回答。

  1. 我认为你的第一个“错误”可能不是相关的,它实际上不是一个错误,它是一个警告,它不会阻止程序运行。
  2. 第二个错误可能是阻止您继续进行的错误。 这是一个例外。 它说java.lang.NoClassDefFoundError: jdk/nashorn/api/scripting/NashornScriptEngineFactory这意味着 Java 找不到被引用的 ZA2F2ED4F8EBC2CBB4C21A29DC40 定义。 I looked up this class in javadocs and it says Since: 1.8u40 which means it was only introduced for the first time in Java 8 update 40. If you have Java 8 with an update version less than 40, your code will not work.

您可以通过在命令行输入java -version来检查您的 java 版本。 在我的系统上,当我运行这个命令时,我得到

PS C:\> java -version                                                                                                   
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

这告诉我我正在运行 Java 8 (1.8) 更新 261

另一件事是您提到您使用的是 Open JDK 8。我的安装是 Oracle Java,我在此处下载。 我不确定NashornScriptEngineFactory是否在您的 Open JDK 版本中可用,或者即使它完全可用,但是,此页面表明它已实现。 我不确定,但我认为它说您可能需要 OpenJDK 9,但我不确定。

我希望我能提供一点帮助。 祝你好运!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM