Знающие джаву помогите
проблема в том что пытаюсь запустить сервер форджа (minecraft) под linux (mint 19.1 cinamonn) запускаю в терминале, а джава выдает такой вот артефакт:
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.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap') at net.minecraft.launchwrapper.Launch.(Launch.java:34) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) . 6 more
Запусти с Java 8 для начала. Не уверен, то они успели портировать на Java 9+.
Проблема у тебя с Java Reflections.
Проще всего зайти на сайт https://bell-sw.com/pages/java-8u232/, скачать Liberica JRE 8 и запустить с его помощью.
Либо можешь поставить пакет openjdk-8-jre или аналог в твоём дистрибутиве.
Если воспользуешься Liberica JRE, то скачай, распакуй. На корень распакованой директории делаешь переменную окружения JAVA_HOME и запускаешь.
Выглядеть это должно примерно так:
#/bin/sh JAVA_HOME="/path/to/your/extracted/installation" "$JAVA_HOME"/bin/java -jar minecraft-server.jar
Minecraft Forums
Hello, I’ve got a problem with my forge server I have done everything correctly and I am getting an error saying «A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException» That’s not the full error but I have no idea what’s wrong can I please get some help?
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.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader ‘bootstrap’)
at net.minecraft.launchwrapper.Launch.(Launch.java:34)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
. 6 more
- Farlander
- Join Date: 9/20/2016
- Posts: 18,480
- Location: Germany
- Member Details
You need Java8 jre to run a server
Currently, you are using jdk
Remove it and install Java 8
space
- Out of the Water
- Join Date: 1/20/2021
- Posts: 6
- Minecraft: RareHyperIonYT
- Member Details
But when i tried to run a paper server it sayed i needed jdk so how am i supposed to use both?
Edit: Also is there anywhere i can go on here i would be able to help others with?
- Farlander
- Join Date: 9/20/2016
- Posts: 18,480
- Location: Germany
- Member Details
Paper server should also run with jre
In your start script you also can use a specific java path
java -Xmx4G -Xms4G -jar server.jar
use the path for «java» — something like:
«c:\program files\java\version\bin\java» -Xmx4G -Xms4G -jar server.jar
space
- Out of the Water
- Join Date: 1/20/2021
- Posts: 6
- Minecraft: RareHyperIonYT
- Member Details
Hello, Thanks for the reply but if you want paper it says to download JDK but anyway thanks for helping i’ll try this
Paper server should also run with jre
In your start script you also can use a specific java path
Instead of
java -Xmx4G -Xms4G -jar server.jar
use the path for «java» — something like:
«c:\program files\java\version\bin\java» -Xmx4G -Xms4G -jar server.jar
Okay, i went into my folder «C:\Program Files\Java\jre1.8.0_281\bin» but idk what im looking for there is javacpl and javaw and javaws which one do i use? there isnt a folder in the bin saying java so im guessing its in there
- Out of the Water
- Join Date: 1/20/2021
- Posts: 6
- Minecraft: RareHyperIonYT
- Member Details
Oh nevermind i got it to work thanks so much for helping me.. is there a way to stop replys on this since i got help?
i have the same proplem i thing.
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:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
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.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader ‘bootstrap’)
at net.minecraft.launchwrapper.Launch.(Launch.java:34)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
. 6 more
can you help me ore somewone else
- Out of the Water
- Join Date: 2/27/2022
- Posts: 4
- Minecraft: MrDuckyRU
- Discord: MrDuckyRU#6003
- Member Details