In this tutorial, I’ll walk you through the steps to install Oracle Java 11 on Ubuntu 20.04/18.04 /16.04 & Debian 10/9. Java 11 is a long-term support (LTS) release made available to the General public on 25 September 2018 and is production-ready.

You can install Java 11 on Ubuntu 20.04/18.04 /16.04 & Debian 10/9 either from one of the following methods:

  1. Java SE Development Kit 11 (JDK 11)
  2. OpenJDK 11

This guide will cover the installation of Oracle Java 11 on Ubuntu 20.04/18.04/16.04 / Debian 9 from both methods.

Install Oracle Java 11 from PPA – Recommended

For Ubuntu 20.04, run:

sudo apt update
sudo apt install openjdk-11-jdk

Ubuntu 18.04/16.04:

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java11-set-default

For Debian 9 / Debian 8:

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

If you don’t want to set Java 11 as default, then install:

sudo apt install oracle-java11-installer

Conform Java verison:

$ java -version
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

Setting Default version of Java

If you have more than one version of Java installed in your system, you can refer to our guide on how to set default version for all applications.

How to set default Java version on Ubuntu / Debian

Manual – Install OpenJDK 11 on Ubuntu 18.04 /16.04 / Debian 9

OpenJDK is a free and open-source implementation of the Java Platform, Standard Edition licensed under the GNU General Public License version 2.

Check the latest release of OpenJDK 11 before running the command below:

curl -O

This will download OpenJDK 11 tar file to your working directory. After the download, extract the archive

tar zxvf openjdk-11.0.2_linux-x64_bin.tar.gz

Move the resulting folder to /usr/local/

sudo mv jdk-11* /usr/local/

Set environment variables

sudo vim /etc/profile.d/


export JAVA_HOME=/usr/local/jdk-11.0.2
export PATH=$PATH:$JAVA_HOME/bin

Source your profile file and check java command

$ source /etc/profile 
$ java -version
openjdk version "11.0.2" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
$ which java

Manual – Install Java SE Development Kit 11 (JDK 11) on Ubuntu 18.04 /16.04 / Debian 9

Download the latest release of JDK 11.

curl -LO -H "Cookie: oraclelicense=accept-securebackup-cookie" \

Then install the package with the dpkgcommand

sudo dpkg -i jdk-11.0.2_linux-x64_bin.deb

If you encounter dependency issues, then run:

$ sudo apt -f install
$ sudo dpkg -i jdk-11.0.2_linux-x64_bin.deb

Set environment variables

sudo vim /etc/profile.d/


export JAVA_HOME=/usr/lib/jvm/jdk-11.0.2/
export PATH=$PATH:$JAVA_HOME/bin

Source the file and confirm Java version installed

$ source /etc/profile.d/
$ java -version
java version "11.0.2" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode

Udemy Video courses on Java:

For CentOS 7 & Fedora Linux distributions, refer to:

How to Install Java 11 on CentOS 7 / Fedora 29 / Fedora 28

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here