How To Install OpenJDK 11 In Ubuntu 18.04, 16.04 or 14.04 / Linux Mint 19, 18 or 17

OpenJDK logo png

Despite OpenJDK 11 being the latest long term release, it's currently only available in Ubuntu 18.10 and newer. This article explains how to install OpenJDK 11 in Ubuntu 18.04, 16.04 or 14.04, and Linux Mint 19.*, 18.* and 17.*, by using an official Ubuntu PPA.

Ubuntu 18.04 and Linux Mint 19.* users will notice that an openjdk-11-jdk package already exists in the repositories, but the Java version contained by this package is actually 10, and not 11:

$ apt-cache policy openjdk-11-jdk
openjdk-11-jdk:
  Installed: 10.0.2+13-1ubuntu0.18.04.4
  Candidate: 10.0.2+13-1ubuntu0.18.04.4
  Version table:
  *** 10.0.2+13-1ubuntu0.18.04.4 500
         500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
         500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
         100 /var/lib/dpkg/status
      10.0.1+10-3ubuntu1 500
         500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

$ java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)

Back in the Ubuntu 18.04 development cycle, there was a SRU exception request to "release OpenJDK 10 as the default JRE/JDK for Bionic, and then move the default JRE/JDK in main to OpenJDK 11 in September/October 2018 as an SRU", this is why the package is called openjdk-11-jdk, even though it contains OpenJDK 10.

While the plan was to update this package to OpenJDK 11 in September / October, that didn't happen as of now. But you can upgrade to OpenJDK 11 by using an official Ubuntu PPA for OpenJDK, which contains packages not only for Ubuntu 18.04 LTS / Linux Mint 19.*, but also for older versions, like Ubuntu 16.04 LTS or 14.04 LTS / Linux Mint 18.* or 17.*.

Using a PPA instead of installing the binaries manually, you'll get automatic updates, as well as proper system integration, just like with the OpenJDK package from the official repositories.

In case you need Oracle JDK 11 instead of OpenJDK, see: How To Install Oracle Java 11 In Ubuntu, Linux Mint Or Debian (From PPA Repository)

Install OpenJDK 11 in Ubuntu or Linux Mint from PPA repository


Ubuntu 18.10 and newer already have OpenJDK 11 in the repositories. To install it, all you have to do is install the openjdk-11-jdk package:

sudo apt install openjdk-11-jdk

To install OpenJDK 11 in Ubuntu 18.04, 16.04 or 14.04 / Linux Mint 19.*, 18.* or 17.*, you'll need to add the OpenJDK builds PPA (maintained by the PPA for OpenJDK team, a sub-team of the Ubuntu OpenJDK team, so the packages come from an official Ubuntu source), and then install the openjdk-11-jdk package:

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt update
sudo apt install openjdk-11-jdk

After the installation, your Java version should now be 11:

$ java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-3ubuntu118.04ppa1)
OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-3ubuntu118.04ppa1, mixed mode, sharing)

If you only need Java JRE, install the openjdk-11-jre package instead of openjdk-11-jdk:

sudo apt install openjdk-11-jre

Going back to the default Ubuntu OpenJDK version


What if you want to remove the packages installed from the OpenJDK builds PPA and go back to the default OpenJDK version provided by Ubuntu / Linux Mint? In this case, you can use the ppa-purge command line utility which disables the PPA and downgrades any packages installed from it:

sudo apt install ppa-purge
sudo ppa-purge ppa:openjdk-r/ppa

On Linux Mint, use this ppa-purge command instead:

sudo ppa-purge -d <corresponding_ubuntu_version> ppa:openjdk-r/ppa

Where corresponding_ubuntu_version is the corresponding Ubuntu version to the Linux Mint version you have installed: bionic for Linux Mint 19.*, xenial for Linux Mint 18.*, and trusty for Linux Mint 17.*