Configure Web UPD8

To install Oracle Java 8, you need to add the Web UPD8 Team Java Personal Package Archive (PPA) repository to your system

A Personal Package Archive (PPA) is a special software repository for uploading source packages to be built and published as an APT repository by Launchpad.

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

Installing Java

After successfully installing Oracle Java, verify the installed version using the following command.

$ java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

Configuring Java Environment

The Web UPD8 PPA repository also provides a package to set required environment variables. If you wish to take advantage of this package, then install using the following command.

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