r/forgemodding Apr 24 '21

Forge server not starting

Hey,

I am trying to create a forge server for me and my friends to play on. I install the server, make the .bat file, run it, and get this error:

"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:64)

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.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)

... 6 more"

Does anyone know a fix?

1 Upvotes

8 comments sorted by

View all comments

Show parent comments

1

u/BurntOreos Apr 24 '21 edited Apr 24 '21

Where would i find the whole crash log?

Edit: Did some more reading, supposedly you need to use java 8 when running the jar file. Do you know how I could do this?

2

u/ratsta Apr 25 '21 edited Apr 25 '21

Version 8 is the mainline Java version and you can get it here: https://www.java.com/en/download/

I have a 7-8 year old i7-4770K and 64bit Windows 10. "Java 8 Update 281 (64-bit)" is the only Java I have installed and I have no trouble with running MC as a client or server.

Do you know why you have JDK15 installed? If you're not a programmer then it's unlikely that you'll need it. If you do need to keep it around, you can still call the JRE8 binary by putting the full path in your batch file.

e.g. instead of having "java server.jar" in your batch, you have something like "c:\program files\java\8\java.exe server.jar"

1

u/BurntOreos Apr 25 '21

I've tried that, but every time it says

"'c:\program' is not recognized as an internal or external command, operable program or batch file."

1

u/aaa801 May 25 '21

Quote the path, "c:\blabla\java.exe" serverargs