My goal is to install a Minecraft server on my Raspberry Pi 4B with 8GB RAM.
I mainly followed this guide which includes a script to install all of the components quickly.
The main commands are:
wget --no-check-certificate --content-disposition https://github.com/ThamesDev/rpi-mc-server/releases/download/1.1.0/rpi-mc-server.tar.gz tar -xvzf rpi-mc-server.tar.gz
And then the script does the following:
sudo mv start-server /usr/bin/start-server cd $HOME mkdir MinecraftServer cd MinecraftServer/ wget https://launcher.mojang.com/v1/objects/0a269b5f2c5b93b1712d0f5dc43b6182b9ab254e/server.jar wget https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jre_arm_linux_hotspot_16.0.1_9.tar.gz tar -xvzf OpenJDK16U-jre_arm_linux_hotspot_16.0.1_9.tar.gz sudo ln -s $HOME/MinecraftServer/jdk-16.0.1+9-jre/bin/java /usr/bin/java
I am quite new to the command line but I am tech-savvy in general. As far as I comprehend it, all the files are where they are supposed to be. This means:
- the start-server file has been moved to /usr/bin
- the MinecraftServer folder exists, in it is the server.jar file and and the .tar.gz file which has been extracted ("tared") to a jdk... file
- the last command (sudo ln...) seems to have worked too, since when now redoing that line I get "the symbolic link could not be created: the file already exists"
What I don't understand is when I try to launch the server, which is done by either
start-server [mb argument for RAM]
or (which is just the command that the start-server script executes)
java -Xmx[mb argument min] -Xms[mb argument max] -jar server.jar nogui
I get the following error:
Beim Laden der Klasse net.minecraft.server.Main ist ein LinkageError aufgetreten java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 55.0
This tells me that something with the JAVA version is wrong. Indeed, when asking "java -version", I get Java 11. However, I also can't switch version, since
sudo update-alternatives --config java gives an error, saying:
There is only one alternative in the link-group (provided by /usr/bin/java): /usr/lib/jvm/java-11-openjdk-armhf/bin/java. Nothing to configure
So my question is: How can I install the newest JAVA version 16 on my Raspberry with Raspbian to avoid this error?
I am aware of another thread about this on this SE. However, as far as I understand it, the script already uses this version of Java from that exact website.
Other guides I tried following but didn't help:
Since a couple other guides mention changing the
$PATH variable I ended up now with quite a mess in there I think, but this is a separate question if this does not interfere with my aim of installing a minecraft server: