How to Install Oracle JAVA 11 LTS and 12 on Ubuntu 19.04

In this post, we'll see how we can install Oracle Java 11 LTS (Long Time Support) and Java 12 on Ubuntu 19.04 (or also Ubuntu 18.04).

Java 11 is the LTS version of Java. As Java 8 has ended support in Junuary 2019, companies will be upgrading their projects to current LTS version.

Java 12 is the latest version which has brought many new features and enhancements.

It's not recommended to use Java 12 in production but you can use it for hobby projects or to experiment with the new features.

How to Install Java 11 LTS on Ubuntu 19.04?

Open a terminal and start by adding the Linux Uprising PPA, which contains Oracle Java 11 (LTS) and 12 installers for Ubuntu, Linux Mint and Debian,using the following command:

sudo add-apt-repository ppa:linuxuprising/java

On Ubuntu 19.04, you don't need to update your system packages using:

$ sudo apt-get update

Finally, you can install Java 11 LTS using:

$ sudo apt-get install oracle-java11-installer

You need to accept the license (press Tab to highlight OK and hit Enter):

Install Java 11 LTS on Ubuntu 19.04

Next, choose Yes:

Install Java 11 LTS on Ubuntu 19.04

Let's make it the default version in our system using:

$ sudo apt-get install oracle-java11-set-default

You can check your installed version of Java using:

$ java -version

Install Java 11 LTS on Ubuntu 19.04

You can uninstall Java 11 from your system using:

$ sudo apt-get remove oracle-java11-installer

Installing Java 12 on Ubuntu 19.04 Using a PPA

You can find the packages of Oracle JDK 12 for Ubuntu from the Linuxuprising PPA repository.

Open a new terminal and run the following command to add this PPA to your system:

$ sudo add-apt-repository ppa:linuxuprising/java

Enter your password when prompted and hit Enter.

Next, you need to run the following command to update your system repositories:

$ sudo apt update

Finally, you can install Java 12 on your system by running the following command:

$ sudo apt install oracle-java12-installer

You can set Java 12 as the default version in your system using oracle-java12-set-default:

$ sudo apt y install oracle-java12-set-default

Installing Java 12 Without a PPA on Ubuntu 19.04

You can also install Java 12 on your system without using a PPA.

Go to the Oracle official website and download the deb package for JDK 12.

Next, open your terminal and navigate to where you have downloaded the deb package and run the following command:

$ sudo dpkg -i jdk-12.0.1_linux-x64_bin.deb

That's it! You have installed Java 12 on your Ubuntu 19.04 system.


In this post, we've seen how to install the latest Java 12 version from Oracle in our Ubuntu 19.04 system. These methods are also valid for Ubuntu 18.04 systems.

About the Author

Techiediaries is a website dedicated to bring you tutorials for the latest web technologies

comments powered by Disqus Protection Status