Posts: 1
Joined: Fri Dec 01, 2023 6:33 pm

Host a Minecraft forge server on Raspberry Pi 5

Fri Dec 01, 2023 7:37 pm

Good evening, since I received the Raspberry Pi 5, I wanted to use it. I was also trying to use it as a host for a small Minecraft server (for conducting some tests). Initially, I tried with the vanilla server version, and everything works correctly.
However, when I try to start a Forge 1.12.2 server using the command:

sudo java -jar servername.jar

it returns the following 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: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

I visited several other MC forums since it's a quite known issue, often resolved by renaming the .jar files or installing Java 8. I've confirmed it's not a file name issue but a lack of Java 8.
I attempted to install Java using the command

sudo apt install default-jdk

which installs openjdk version "17.0.9". Trying to install version 8 with

Code: Select all

sudo apt install OpenJDK-8-jdk
didn't work, and manual installation was unsuccessful. (This is also my first experience with the Linux world.)
Can someone help me? Thank you in advance.

Posts: 20
Joined: Sat Aug 18, 2012 3:14 am
Location: York, PA USA

Re: Host a Minecraft forge server on Raspberry Pi 5

Sun Dec 03, 2023 3:58 pm

What you may want is opendjdk-8-jre instead. I know for current vanilla, I use openjdk-17-jre and it works. You may run into problems with the 17 installed first. Either remove it or start from a fresh OS and only install 8-jre and see if that works.

Return to “Gaming”