How to Install Java on Debian 10

Install Java on Debian 10

In this article, we will have explained the necessary steps to install and configure Java on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Java is one of the most popular programming languages used to build different kinds of applications and systems. Applications developed in Java are scalable, flexible and maintainable. Over 3 billion devices run on Java.

Install Java on Debian

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

Step 2. Install Java on Debian.

Run the following commands to install the OpenJDK 11 JDK package:

Confirm the installation and check the version typing following command:

Step 3. Setting up default Java Version.

Now to change default Java version run following command:

  • OpenJDK 11 is located at /usr/lib/jvm/java-11-openjdk-amd64/bin/java. Once you found the path of your preferred Java installation, open the /etc/environment file:

Add the following line to the end of file:

Now verify JAVA_HOME path typing:

Congratulation, you have learned how to install and configure Java on Debian 10 Buster. If you have any question, please leave a comment below.