sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt install openjdk-21-jre-headless

This repository kept crashing.  I uninstalled it and put on Oracle 21 below

Check out the Our Java MC world for pictures of our builds.  I will be adding pictures from our children’s builds interiors.  

Directions on installing

 

Step 1 — Installing the Necessary Software Packages and Configure the Firewall

Oracle Java doesn’t use a repository to update the JDK-21 files.  I will have to manually do it.   I uninstalled all other versions of Java.

JDK 21 is the previous Long-Term Support (LTS) release of the Java SE Platform.

 

Use Oracle JVM 21 
Oracle JVM 21 latest

Oracle latest jdk-21

Go into /usr/lib/jvm and extract it 

sudo apt install jdk-21_linux-x64_bin.deb

Go into /user/lib/jvm and rename the folder to jdk-21

Register it

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-21/bin/java 1
sudo update-alternatives --config java
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/jdk-21/bin/java 1 auto mode
1 /usr/lib/jvm/jdk-21/bin/java 1 manual mode

Press <enter> to keep the current choice[*], or type selection number:

Setting JAVA_HOME: To ensure build tools recognize the new version, add this line to your ~/.bashrc file:

export JAVA_HOME=/usr/lib/jvm/jdk-25
sudo vim /etc/environment
JAVA_HOME="/usr/lib/jvm/jdk-21/"
JDK_JAVA_OPTIONS=
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"