How to install Oracle Java 9 in Ubuntu 16.04

This tutorial will show you step by step instructions to install Oracle Java 9 easily on Ubuntu 16.04 using PPA.

Java SE 9 is the latest update to the Java Platform.

Steps

  1. Open a terminal and add PPA using following command. You need sudo access to this.

Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK8 / JDK9). There are no actual Java files in this PPA. Ubuntu 16.10 Yakkety Yak is no longer supported by Canonical (and thus, Launchpad and this PPA). The PPA supports Ubuntu 17.10, 17.04, 16.04, 14.04 and 12.04.

sudo add-apt-repository ppa:webupd8team/java
Oracle Java installer

2. Update package repository using following command.

sudo apt-get update

3. Download and Install the installer script.

sudo apt install oracle-java9-installer
Oracle Binary Code License Agreement
In order to install this package, you must accept the license terms

4. Set Oracle JDK9 as default, to set oracle jdk9 as default, install the “oracle-java9-set-default” package. This will automatically set the JAVA env variable.

sudo apt install oracle-java9-set-default

This will complete your installation, you can check you java version by running following command.

javac -version