Can't start a server that is version 1.20.5 or up

I had this issue too and i have just got it to work. I’m a linux noob and i have no idea what i’m really talking about so i have no idea if i did something wrong or made my os unstable or anything so follow it at your own risk.

I have mostly followed this guide

the first thing i did was update the packages

sudo apt update
sudo apt upgrade

then on the oracle website i downloaded the x64 Compressed Archive like they said in the guide. i have seen that JDK 22 exists now but i have still downloaded JDK 21 just to follow the guide as closely as possible

then i copied the file into /tmp using FileZilla
then i ran this command. make sure to change the name and ip to your server

scp /tmp/jdk-21_linux-x64_bin.tar.gz mc@192.168.0.197:/tmp

it asked me to add this ip to the list of known hosts (no idea what this is) but i said yes.

now we navigate to the file, extract the files and move it to /usr/lib/jvm/

mc@mineos-tkldev ~$ cd /tmp
mc@mineos-tkldev /tmp$ tar -xzf jdk-21_linux-x64_bin.tar.gz
mc@mineos-tkldev /tmp$ sudo mv jdk-21.0.3 /usr/lib/jvm/oracle-jdk-21.0.3

now when i looked at the version of java it still told me i had 17.0.11.

trying to do

sudo update-alternatives --config java

told me “There is only one alternative in link group java”
also listing the content of the folder gave me this (oracle-jdk-21.0.3 is the one we just installed)
image

after that i asked chatGPT what to do and it told me to execute the following 2 commands

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/oracle-jdk-21.0.3/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/oracle-jdk-21.0.3/bin/javac 1

and after executing both i was able to select the correct version

that’s everything. i was now able to play 1.20.6 and 1.21.