Configuring alternatives in CentOS (e.g. Oracle Java SE)

The installation of Oracle Java SE (JDK) on some Linux distribution is still a fight. Probably the most staright forward way on Cent OS is downloading and installing the most current  self-exctracting archive (.bin) and installing it to /opt.

Finally, ensure the Oracle Java SE binary ist called instead of the GNU ones.

#alternatives --install /usr/bin/java java /opt/jdk1.6.025/bin/java
#alternatives --config java

There are 2 programs which provide 'java'.

Selection Command
------------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
2 /opt/jdk1.6.025/bin/java

 

Enter to keep the current selection[+], or type selection number: 2