If you want to have sevral versions of java and choose one of them:
cd /opt/jdk1.8.0_45/
alternatives –install /usr/bin/java java /opt/jdk1.8.0_45/bin/java 2
alternatives –config java
There are 3 programs which provide ‘java’.
Selection Command
———————————————–
* 1 /opt/jdk1.7.0_71/bin/java
+ 2 /opt/jdk1.8.0_25/bin/java
3 /opt/jdk1.8.0_45/bin/java