How To Install Java on Debian 11

In this article, we want to teach you How To Install Java on Debian 11.

Java is a widely used object-oriented programming language and software platform that runs on billions of devices. like notebook computers, mobile devices, gaming consoles, medical devices, and many others.

The rules and syntax of Java are based on the C and C++ languages.

How To Install Java on Debian 11

In this article, you will install the JRE and the JDK using Debian’s APT package management system.

To install Java you need to log in to your server as a non-root user with sudo privileges. For this, you can check our article about the Initial server setup with Debian 11.

Install the Default JRK/JDK on Debian 11

By default, OpenJDK version 11, which is an open-source variant of the JRE and JDK, and is matchable with Java 11, is available on the Debian default repository.

Update and upgrade the APT packages with the following command:

sudo apt update && apt upgrade

Now check that you install Java or not on Debian 11 with the following command:

java -version

If Java is not installed, you’ll see the following output:

Output
-bash: java: command not found

Then, install OpenJDK on Debian 11 with the following command:

sudo apt install default-jre

With this command, you will install the JRE that allows you to run all Java software.

Now check for the Java installation again:

java -version

In your output you will see:

Output
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2)
OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)

You need to install JDK too. to do this run the following command:

sudo apt install default-jdk

Verify that you have installed it correctly:

javac -version

Your output should similar to this:

Output
javac 11.0.12

Here you are done with the installation of the default JDK/JRK on Debian 11.

Conclusion

At this point, you learn what is Java and you can easily install the JRE and the JDK using Debian’s APT package management system.

Hope you enjoy this article about How To Install Java on Debian 11.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!