I’d downloaded jre-1.7_79 from java.sun.com, and therefore, wanted to ensure my system was allowed to use this as part of alternatives, without having to do everything manually. It’s nice and easy, all you have to do is:
alternatives–install /usr/bin/java java /usr/java/jre1.7._79/bin/java 3
this then adds java to position three within alternatives. The reason I did this, was because position 1 and 2 was already taken by jre-1.5.0-gcj and jre-1.6.0 that comes pre-installed on RHEL 6.5. After you’ve added it to the alternatives, you then need to activate it if you wish to use this version, so:
update-alternatives –config java
and then choose position 3 to use the version you’ve just installed. When you then run:
from the command prompt, it will or should show the version you’ve just installed and added to alternatives.