Tuesday, August 15, 2017

Install Oracle Java 8 or Oracle Java 9 in Ubuntu 16.04

Step 1: Open terminal (Ctrl+Alt+T) and run the command
$ sudo add-apt-repository ppa:webupd8team/java

Step 2: Update system package index
$ sudo apt update

Step 3: Install Java. Note: Replace oracle-java8-installer with oracle-java9-installer to install Java 9.
$ sudo apt install oracle-java8-installer

Step 4: Check whether installation is successful
$ javac -version

If successful the above command will give a similar output as below:
javac 1.8.0_144

1 comment: