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.

sudo apt update
sudo apt upgrade

Step 2. Install Java on Debian.

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

sudo apt install default-jdk

Confirm the installation and check the version typing following command:

# java -version
openjdk version "11.0.3" 2019-08-17
OpenJDK Runtime Environment (build 11.0.3+7-post-Debian-5)
OpenJDK 64-Bit Server VM (build 11.0.3+7-post-Debian-5, mixed mode, sharing)

Step 3. Setting up default Java Version.

Now to change default Java version run following command:

sudo update-alternatives --config java
  • 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:
sudo nano /etc/environment

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.