This tutorial will help you to install Java on Debian 10 Buster Linux system.

Step 1 – Search OpenJDK Packages

OpenJDK packages are available under native apt repositories. You can simply use apt-cache search command to search available java version for your Ubuntu system. As per above output, you can see openjdk-11-* and openjdk-8-* is available in the package manager.

Step 2 – Install Java on Debian 10

Use the below command to install OpenJDK on your Debian 10 Buster systems using the package manager from the default repository. The below commands will install Java Development Kit (JDK) and Java Runtime Environment (JRE) both on your system. You can install JRE package only to setup Runtime Environment only. Choose one of the below option to install Java on Debian 10:

Installing Java 14:sudo apt install openjdk-14-jdk Installing Java 11:sudo apt install openjdk-11-jdk Installing Java 8:sudo apt install openjdk-8-jdk Step 3 – Configure Default Java VersionThe newly installed OpenJDK Java 11 will be configured as default Java version. But in some cases, you may need to change the default Java version. Run the following command on terminal:

This will list all configured Java versions on your system. Choose the appropriate version number as showing in below screenshot. A star (*) shows the currently active version. Here I choose 0 for OpenJDK 11 and press enter.

After installation of Java uses below command to verify the installed version of Java on your system.

Step 4 – Setup Java Environment

It is the best practice to set Java environment variable after installing java. To setup java environment variabless, add the following line to /etc/profile.d/java.sh. Load the environment to current shell. Now, the JAVA_HOME will automatically set even after system reboot. Use the following command to check the environment variable value

Conclusion

In this descibed you ot how to install Java (OpenJDK) 14, 11 and 8 on a Debian system.

How To Install Java on Debian 10  Buster    TecAdmin - 68