1)Install Oracle Java 8 

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

2) set default java version

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

3) Verify java Installation

java -version

Result:

java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

4) Setup environment variables

cat >> /etc/environment <<EOL
JAVA_HOME=/usr/lib/jvm/java-8-oracle
JRE_HOME=/usr/lib/jvm/java-8-oracle/jre
EOL

You have successfully installed Java 8.

Note- PATH OF YOUR SYSTEM MAY DIFFER PLEASE CHECK AND THEN SET THE ENVIRONMENT VARIABLES.