When you install a product for example 12 C versions Oracle when you are running the installer this ask you for a specific JAVA version and there is no other way to set that if you don't install it, even when set JAVA_HOME, JRE_HOME, JDK_HOME, (Or I haven't find it yet)
So, download the JAVA version you want and move it to:
/usr/lib/jvm/jdk1.7.0_79 (for example)
To set your JAVA version and associate it to java command, then configure the JAVA command, with root privileges run:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_79/bin/java" 1
sudo update-alternatives --config java
Optionally you can set:
export JAVA_HOME=/usr/java/jdk1.7.0_79
export JRE_HOME=/usr/java/jdk1.7.0_79/jre
export JDK_HOME=/usr/java/jdk1.7.0_79
In your bash_profile.
Restart bash or reboot.
Note:
When you install java with rpm option, this is installed in /user/java/(java_version)
Annexed:
Remove-->
sudo update-alternatives --remove "java" "/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java"
Note:
When you install java with rpm option, this is installed in /user/java/(java_version)
Annexed:
Remove-->
sudo update-alternatives --remove "java" "/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java"