我正在为经过修改的 minecraft 服务器运行 Linux(debian)虚拟机。原版服务器运行良好,但当我运行 LaunchServer.bat 时,经过修改的服务器会给出此错误。我认为这与 Java 安装有关,但不知道如何从 Java 11 切换。
root@minecraft:/home/MCEternal/Eternal (ServerPack 1.3.7)# bash LaunchServer.bat
OpenJDK 64-Bit Server VM warning: Ignoring option PermSize; support was removed in 8.0
A problem occurred running the Server launcher.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:566)
at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:70)
at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:34)
Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLC
lassLoader (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
答案1
我在 java 11 上运行服务器时遇到了这个问题,请尝试切换到 java 8 来运行它。
您可以使用命令sudo update-alternatives --config java
从已安装的 Java 版本中选择要使用的 Java 版本。