I'm trying to set up a private Forge server on my Windows PC for multiple reasons and have run into a problem I cannot find any answers for. When I try to run the Forge .jar via command prompt, I get an error message. I initially thought it was because I was using a newer version of Java than Java 8, so I installed it, and it seems like it is the default now, but the error keeps happening.
Here's the error:
A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:110)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
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.<init>(Launch.java:34)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
... 3 more
When I run it using javaw instead of java, I don't get any error dialog.
I'm trying to set up a private Forge server on my Windows PC for multiple reasons and have run into a problem I cannot find any answers for. When I try to run the Forge .jar via command prompt, I get an error message. I initially thought it was because I was using a newer version of Java than Java 8, so I installed it, and it seems like it is the default now, but the error keeps happening.
Here's the error:
When I run it using javaw instead of java, I don't get any error dialog.
You are using the wrong java version
Minecraft 1.16 and older: Java 8
Minecraft 1.17: Java 16
Minecraft 1.18 and newer: Java 17
For your Server, make sure you have the correct Java version installed
For example, using a 1.19.2 server, use this script:
Make sure the javaw.exe path is correct, keep the quotation marks.
The server jar name has to match with your script
I can't find any unarchived downloads for JDK 8 and neither of the two versions of JDK I already have installed seem to work.
Which Minecraft version do you want to use?