Setting the default JDK with the /usr/sbin/alternatives Utility

Setting up a new Java version with the Linux Alternatives system

To install the Oracle Java JRE after the .rpm installation as the default Java on a linux system: <the current example below will install version 6 update 35>

Note: The best command for the Java JDK install is : yum localinstall <package-name-of-jdk>


alternatives --install /usr/bin/java java /usr/java/jre1.6.0_35/bin/java 20000 --slave /usr/bin/keytool keytool /usr/java/jre1.6.0_35/bin/keytool --slave /usr/bin/orbd orbd /usr/java/jre1.6.0_35/bin/orbd




Installing Java JRE and JDK version 1.7(1.6) on CentOS 6 and config the system alternatives for "java"

You should simply use the packages from Sun.

Step (1) : Visit Sun’s web site and download the latest version of Java (the *.bin file not the *-rpm.bin) (

(pay close attention if you want the 32bit or 64bit version)

Example the 64-bit version of the JDK can be found at

Subscribe to RSS - alternatives