一个非法的反射访问操作发生在尝试从Eclipse运行Minecraft时。

huangapple go评论76阅读模式
英文:

An illegal reflective access operation has occurred when trying to run Minecraft from Eclipse

问题

以下是翻译好的内容:

我想开始修改Minecraft,但是我无法从Eclipse启动它。当我尝试使用Run Configurationsnet.minecraftforge.legacydev.MainClient运行配置时,我收到以下错误消息:

[2020-10-18 19:22:51] [INFO   ] Natives: C:\Users\MyPC\Documents\Projects\Forge-MDK\build\natives 
警告: 发生了非法的反射访问操作
警告: 非法的反射访问: net.minecraftforge.legacydev.MainClient (file:/C:/Users/MyPC/.gradle/caches/modules-2/files-2.1/net.minecraftforge/legacydev/0.2.3.1/f2cd4a8c9f09faf1c1e4a9a4c65df36e634f95db/legacydev-0.2.3.1-fatjar.jar) 对 java.lang.ClassLoader.initializePath(java.lang.String) 方法
警告: 请考虑向 net.minecraftforge.legacydev.MainClient 的维护者报告此问题
警告: 使用 --illegal-access=warn 以启用进一步的非法反射访问操作警告
警告: 所有非法访问操作在将来的版本中都将被拒绝
[2020-10-18 19:22:51] [INFO   ] Main Class: net.minecraft.launchwrapper.Launch 
[2020-10-18 19:22:51] [INFO   ] Srg2Mcp: C:\Users\MyPC\Documents\Projects\Forge-MDK\build\createSrgToMcp\output.srg 
[2020-10-18 19:22:51] [INFO   ] Extra: [] 
[2020-10-18 19:22:51] [INFO   ] Running with arguments: [--version, 1.16.2, --assetIndex, 1.12, --assetsDir, C:\Users\MyPC\.gradle\caches\forge_gradle\assets, --accessToken, {REDACTED}, --userProperties, [], --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker] 
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at net.minecraftforge.legacydev.Main.start(Main.java:86)
	at net.minecraftforge.legacydev.MainClient.main(MainClient.java:29)
Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
	at net.minecraft.launchwrapper.Launch.<init>(Launch.java:34)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	... 6 more

我之前查阅了类似的问题,并且一般的共识是Minecraft不支持最新版本的Java,我需要使用Java 8(或1.8)。所以,我将Eclipse首选项更改为执行环境设置为Java Platform,Standard Edition 8.0。我还下载了版本为openjdk version "1.8.0_265"的JDK,并将编译器首选项设置为1.8。但是这些方法都没有解决这个问题。我知道如果我使用Java 8,这个问题是不可能出现的,那我忘记了什么?

提前感谢!

英文:

I want to start modding Minecraft, but I am unable to launch it from Eclipse. Here is the error message I recieve when I try to use Run Configurations with net.minecraftforge.legacydev.MainClient:

[2020-10-18 19:22:51] [INFO   ] Natives: C:\Users\MyPC\Documents\Projects\Forge-MDK\build\natives 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.minecraftforge.legacydev.MainClient (file:/C:/Users/MyPC/.gradle/caches/modules-2/files-2.1/net.minecraftforge/legacydev/0.2.3.1/f2cd4a8c9f09faf1c1e4a9a4c65df36e634f95db/legacydev-0.2.3.1-fatjar.jar) to method java.lang.ClassLoader.initializePath(java.lang.String)
WARNING: Please consider reporting this to the maintainers of net.minecraftforge.legacydev.MainClient
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
[2020-10-18 19:22:51] [INFO   ] Main Class: net.minecraft.launchwrapper.Launch 
[2020-10-18 19:22:51] [INFO   ] Srg2Mcp: C:\Users\MyPC\Documents\Projects\Forge-MDK\build\createSrgToMcp\output.srg 
[2020-10-18 19:22:51] [INFO   ] Extra: [] 
[2020-10-18 19:22:51] [INFO   ] Running with arguments: [--version, 1.16.2, --assetIndex, 1.12, --assetsDir, C:\Users\MyPC\.gradle\caches\forge_gradle\assets, --accessToken, {REDACTED}, --userProperties, [], --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker] 
Exception in thread &quot;main&quot; java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at net.minecraftforge.legacydev.Main.start(Main.java:86)
	at net.minecraftforge.legacydev.MainClient.main(MainClient.java:29)
Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader &#39;bootstrap&#39;)
	at net.minecraft.launchwrapper.Launch.&lt;init&gt;(Launch.java:34)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	... 6 more

I've checked out similar questions to mine before, and the general consensus was that the newest version of Java was not supported by Minecraft, and I would have to use Java 8 (or 1.8). So, I changed my Eclipse preferences to have my execution environment set to Java Platform, Standard Edition 8.0. I also downloaded the JDK with version openjdk version &quot;1.8.0_265&quot; and set the compiler preference to 1.8. None of these methods have resolved this issue. I know that this issue should not be possible if I am using Java 8, so what am I forgetting about?

Thanks in advance!

答案1

得分: 1

我刚刚为自己解决了这个问题。我不得不将 jre1.8.0_261 添加到“Java > 已安装的 JRE”,然后选择“Java > 已安装的 JRE > 执行环境”,确保下拉菜单显示为“CDC-1.0/Foundation-1.0(jre1.8.0_261)”。

英文:

I just solved this issue for myself. I had to add jre1.8.0_261 to "Java > Installed JREs", then select "Java > Installed JREs > Execution Environments" and make sure the dropdown shows "CDC-1.0/Foundation-1.0(jre1.8.0_261)".

答案2

得分: 0

我有同样的问题,但不知道如何解决,在Java>已安装的JRE中,我有:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

C:\Users\Paulo.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_14.0.2.v20200815-0932\jre

<!-- end snippet -->

在Java>已安装的JRE>执行环境中,我有:

CDC-1.0/Foundation-1.0

OSGi/Minimum-1.0

CDC-1.1/Foundation-1.1

JRE-1.1

OSGi/Minimum-1.1

J2SE-1.2

OSGi/Minimum-1.2

J2SE-1.3

J2SE-1.4

J2SE-1.5

JavaSE-1.6

JavaSE-1.7

JavaSE-1.8

JavaSE-9

JavaSE-10

JavaSE-11

JavaSE-12

JavaSE-13

JavaSE-14

在表格中,没有CDC 1.0/Foundation 1.0(JRE 1.8.0 261)。

英文:

i have the same problem but idk how to solve it, at Java>Installed JREs i have

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

C:\Users\Paulo\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_14.0.2.v20200815-0932\jre

<!-- end snippet -->
and at Java> Installed JREs>Execution Environments i have
CDC-1.0/Foundation-1.0
OSGi/Minimum-1.0
CDC-1.1/Foundation-1.1
JRE-1.1
OSGi/Minimum-1.1
J2SE-1.2
OSGi/Minimum-1.2
J2SE-1.3
J2SE-1.4
J2SE-1.5
JavaSE-1.6
JavaSE-1.7
JavaSE-1.8
JavaSE-9
JavaSE-10
JavaSE-11
JavaSE-12
JavaSE-13
JavaSE-14

and at the table none has CDC 1.0/ Foundation 1.0(JRE 1.8.0 261)

huangapple
  • 本文由 发表于 2020年10月19日 12:58:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/64421398.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定