Change Default Java

Linux Version : Ubuntu ( Debian Base )

In linux you can install many java version and change easily between version. So you can use java 8 as base version but using another java for anything else.

sudo update-alternatives --config java

Script above will show this result :

sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                      Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6.31-oracle/bin/java     1062      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-6.31-oracle/bin/java     1062      manual mode

Press enter to keep the current choice[*], or type selection number:

And then you can choose java version you want!!

Source

Installing Oracle Java

Linux Version : Ubuntu ( Debian Base )

If you just download .tar.gz from Oracle you will need to configure the java too. So this script below will help you to installing oracle java application.

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