Step 1 – Add Oracle’s PPA:

sudo add-apt-repository ppa:webupd8team/java

Step 2 – Update package repository

sudo apt-get update

Step 3 – Install Oracle JDK 8:

sudo apt-get install oracle-java8-installer