(Last Updated On: January 31, 2018)

Welcome to our guide to Installing latest Oracle Java 9 on Ubuntu / Debian. Java 9 is the latest release of Java as of this writing, that contains new features, enhancements and bug fixes to improve efficiency to develop and run Java programs. In this blog post, I’ll guide you through the steps to get the latest version of  Oracle Java 9 installed on Ubuntu 16.04 and Debian 9.

Oracle JDK 9 is now considered stable. There are currently only 64bit builds (no other builds are available for download) :

To install latest Oracle Java, we utilize webupd8team/java PPA. The PPA (Personal Package Archives) allows you to upload Ubuntu source packages to be built and published as an apt repository by Launchpad. This is the safest way to share Debian and Ubuntu packages without pushing them to the upstream repositories,

Add  webupd8team/java  PPA

To add the required PPA, run the following commands on your terminal.

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

Once it is done, update the apt-cache index.

$ sudo apt-get update

You can also modify the sources.list file by adding the content shown below.

For Ubuntu 16.04, add these content to /etc/apt/sources.list.d/java.list

deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main 
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main

For Ubuntu 17.10:

deb http://ppa.launchpad.net/webupd8team/java/ubuntu artful main 
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu artful main

For Ubuntu 17.04:

deb http://ppa.launchpad.net/webupd8team/java/ubuntu zesty main 
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu zesty main

For Ubuntu 18.04

deb http://ppa.launchpad.net/webupd8team/java/ubuntu bionic main 
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu bionic main


Installing latest Oracle Java 9 on Ubuntu / Debian

After adding PPA. Do a test by checking for packages with name java9.

$ apt-cache search oracle-java9
oracle-java9-installer - Oracle Java(TM) Development Kit (JDK) 9
oracle-java9-set-default - Set Oracle JDK 9 as default Java
oracle-java9-unlimited-jce-policy - Unlimited JCE Policy for Oracle Java 9

We have confirmed that Java 9 is available. Install it by running the commands:

$ sudo apt-get install oracle-java9-installer

If you have more than one java on your system and wants to set Java 9 as default, you can consider installing oracle-java9-set-default package. This is done by running the commands:

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

You should now have the latest java installed on your Ubuntu or Debian machine.

Wrapping up.

In this Installing latest Oracle Java 9 on Ubuntu / Debian guide, full steps of getting Java 9 have been covered, The same PPA provides packages for older versions of Java like Java 8 and Java 7. Feel free to install them if your application requires this specific version.