VARIANT 1:



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

http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/






VARIANT 2:



Remove OpenJDK (If OpenJDK installed)
$ sudo apt-get purge -y openjdk*



Then add on .bashrc link on file .bash_profile. (as redhat distributives):

$ vi ~/.bashrc

############################################################
# To use bash_profile as file with Locat Variables
. ~/.bash_profile 
############################################################



Then do same