Install Oracle Java 12 on Debian 10

Last Updated:

This tutorial will guide you on how to install Oracle Java 12 on Debian 10.

Installing Oracle Java 12 on Debian 10

To install the official Oracle Java on Debian 10, you need to add the PPA repository. But before that, ensure that your system packages are up-to-date.

sudo apt update
sudo apt upgrade

Add Linux Uprising Java PPA Repository

To install Java 12 on Debian 10, you need to add the linux uprising java PPA repository as shown below;

echo "deb bionic main" | sudo tee /etc/apt/sources.list.d/linuxuprising-java.list
sudo apt install dirmngr
sudo apt-key adv --keyserver hkp:// --recv-keys 73C3DB2A

Installing Oracle Java 12 on Debian

Once you have the Linux Uprising repositories to install Java 12, proceed to do the installations.

sudo apt update
sudo apt install oracle-java12-installer

Verify Java Installation

Once the installation is done, run the command below to verify the installed Java version.

java --version
java 12.0.1 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)

If you need to set Oracle Java 12 as the default Java version, install the following package if not already installed.

sudo apt install oracle-java12-set-default

Define JAVA_HOME Environment Variable

If you have multiple versions of Java installed and want to set Java 12 as the default, you need to set Java 12 home environment variable. Before that, you need to find the Java 12 install location by running the command below;

sudo update-alternatives --config java
There is 1 choice for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
0 /usr/lib/jvm/java-12-oracle/bin/java 1091 auto mode
1 /usr/lib/jvm/java-12-oracle/bin/java 1091 manual mode
Press to keep the current choice[*], or type selection number:

Now that we got the Java 12 install location, press Ctrl+c and open the /etc/environment configuration file where you can set Java home environment variable as shown below.

vim /etc/environment

Next, source the /etc/environment file to load the environment variables.

source /etc/environment

To confirm the Java home environment variable setting, run the command below;


Well, you are good to go. That is all on how to install Oracle Java 12 Debian 10. See other related guides by following the links below;

Install Oracle Java 12 on CentOS 7/Fedora 29

How to Manually Install Oracle Java 12 on Debian 9.8/Ubuntu 18.04

Install Oracle Java 12 on Ubuntu 18.04/Debian 9.8

Install Java 11 on Debian 9.8/Ubuntu 18.04


We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Jay Decrame
Linux Certified Engineer, Technology and Linux/Unix enthusiast.

Leave a Comment