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.

Conclusion

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.

Note: We also publish our tutorials on Medium and DEV.to. If you prefer reading in these platforms, you can follow us there to get our newest articles.

You can reach the author via Twitter:

About the author

Ahmed Bouchefra
is a web developer with 5+ years of experience and technical author with an engineering degree on software development. You can hire him with a click on the link above or contact him via his LinkedIn account. He authored technical content for the industry-leading websites such as SitePoint, Smashing, DigitalOcean, RealPython, freeCodeCamp, JScrambler, Pusher, and Auth0. He also co-authored various books about modern web development that you can find from Amazon or Leanpub


Get our Learn Angular 8 in 15 Easy Steps ebook in pdf, epub and mobi formats, plus a new Angular 8 tutorial every 3 days.


Online Courses (Affiliate)

If you prefer learning with videos. Check out one of the best Angular courses online
Angular 8 - The Complete Guide (2019+ Edition)

Angular Crash Course for Busy Developers

comments powered by Disqus
DMCA.com Protection Status