Install Java 21 on Debian 12

Published on Updated on 1 min read

You want to install Java 21 on your Debian 12/11/10 operating system? Then you're in the right place!

You want to install Java 21 on your Debian 12/11/10 operating system? Then you're in the right place!

First, it's important to update the package list of your Debian system and install any possible updates. You can do this with a simple command:

apt update && apt upgrade -y

If you want to install Java 21 on Debian 12/11/10, you can do so with a simple command:

wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb
sudo dpkg -i jdk-21_linux-x64_bin.deb

Check if the installation was successful:

It's important that you also check if the installation was successful at the end. You can easily check this by querying the Java version.

java -version

If you see your desired Java version here, the installation was successful.

If you see a different Java version, you might need to set the default Java version. You can list your Java versions with the following command:

sudo update-alternatives --list java

To set Java 21 as the default Java version, simply select the Java 21 version from the list. An example would be as follows:

sudo update-java-alternatives --set  /usr/lib/jvm/jdk-21-oracle-x64

Now you can check the Java version again:

java -version

If you see your desired Java version here, the installation was successful.

Java 21 OpenJDK Eclipse Temurin Debian 13 Debian 12 Debian Java installieren