Install Java on Ubuntu
The easiest way to install Oracle Java 8 is to run the following commands from the terminal.
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
Verify the installed Java version using the following :
$ java -version
It should output something like the following :
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)