Install Java 11 on Debian 9.8/Ubuntu 18.04


Let us learn how to install Java 11 on Debian 9.8/Ubuntu 18.04. To make the install of Java 11 a hustle free, you can simply use the Linux Uprising PPA repository.

Create Linux Uprising Java PPA Repo

Creation of the Linux Uprising Java PPA repo on Ubuntu 18.04 and Debian 9 differs. Hence see below on how to add this repos on each flavor.

On Ubuntu 18.04

sudo apt install software-properties-common
sudo add-apt-repository ppa:linuxuprising/java

On Debian 9.8

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

Install Java 11 on Ubuntu 18.04/Debian 9.8

Perform system update

sudo apt update

Download Java 11 archive from Java downloads page. Note that you need to login before you can download Java 11. The version to be downloaded should match with the version provided by the PPA repos.

apt-cache policy oracle-java11-installer-local
  Installed: (none)
  Candidate: 11.0.3-1~linuxuprising1
  Version table:
     11.0.3-1~linuxuprising1 500
        500 bionic/main amd64 Packages

Once you have downloaded Oracle Java 11 archive, create a Java 11 local installer directory under the /var/cache and copy the downloaded archive above to the directory. See below;

mkdir -p /var/cache/oracle-jdk11-installer-local
cp jdk-11.0.3_linux-x64_bin.tar.gz /var/cache/oracle-jdk11-installer-local

Next, install Java 11 by running the command below;

apt install oracle-java11-installer-local

During the installation, you are prompted to accept the Oracle Java license agreement. Accept it to proceed with installation.

Verify Java Installation

You can verify the installation of Java 11 by running the command below;

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

If you are running multiple versions of Java on your system and want to make Java 11 the default, you can use update-alternatives command.

Set JAVA_HOME environment variable

To set the JAVA_HOME environment variable, you first need to find the default install location of JAVA. You can use the update-alternatives command.

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-11-oracle/bin/java 1091 auto mode
1 /usr/lib/jvm/java-11-oracle/bin/java 1091 manual mode
Press to keep the current choice[*], or type selection number: ^C

So, the default Java 11 install location is /usr/lib/jvm/java-11-oracle. Press Ctrl C and proceed to set JAVA_HOME environment variable.

echo 'JAVA_HOME="/usr/lib/jvm/java-11-oracle"' >> /etc/environment
source /etc/environment

Verify the environment variable.


You can also set Oracle JDK 11 as default by installing the oracle-java11-set-default-local package.

sudo apt install oracle-java11-set-default-local

Great. You are good to go. That is all it takes to get Java 11 running on Ubuntu 18.04/Debian 9.8. Feel free to drop the comments.

Want to install other versions of Java? See our links below;

Install Oracle Java 11 on Fedora 29/CentOS 7

Install Oracle Java 12 on Ubuntu 18.04/Debian 9.8

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

Install Oracle Java 12 on CentOS 7/Fedora 29


Please enter your comment!
Please enter your name here