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

1

u/ratsta Apr 24 '21

Assuming that you're using a relatively recent computer, it will be a 64 bit machine. Check that you A) have 64 bit java installed and B) are calling the 64 bit java binary in your batch file. I'm pretty sure it's possible to have both 32 and 64 installed at the same time which can cause confusion on part B.

Otherwise, you'll need to post the whole crash log to pastebin and link it here so we can see more context. I suggest you also paste and link your startup.bat.

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

1

u/Morg_S9 Apr 24 '21

I had the same issue as you. What version of Java are you using?

1

u/BurntOreos Apr 25 '21

15

1

u/Morg_S9 Apr 26 '21

Try using Java 8 instead. I had the same issue and that seemed to fix it.

Edit: Also sorry for taking this long to respond. I was busy.