in this method you don't need to manually configure java path it will be set by default
Enter step by step in command promt
sudo apt-add-repository ppa:webupd8team/java
sudo update-alternatives --config java
sudo apt-get install oracle-java8-set-default