Appendix A. Setting the default JDK with the /usr/sbin/alternatives Utility
/usr/sbin/alternatives is a tool for managing different software packages that provide the same functionality. Red Hat Enterprise Linux uses /usr/sbin/alternatives to ensure that only one Java Development Kit is set as the system default at one time.
Important
/usr/sbin/alternatives may contain conflicting configurations. Refer to Procedure A.1, “Using /usr/sbin/alternatives to Set the Default JDK” for syntax of the /usr/sbin/alternatives command.
Procedure A.1. Using /usr/sbin/alternatives to Set the Default JDK
Become the root user.
/usr/sbin/alternativesneeds to be run with root privileges. Use thesucommand or other mechanism to gain these privileges.Set
java.Input this command:/usr/sbin/alternatives --config javaNext, follow the on-screen directions to ensure that the correct version ofjavais selected. Table A.1, “javaalternative commands” shows the relevant command settings for each of the different JDKs.Table A.1.
javaalternative commandsJDK alternative command OpenJDK 1.6 /usr/lib/jvm/jre-1.6.0-openjdk/bin/javaSun Microsystems JDK 1.6 /usr/lib/jvm/jre-1.6.0-sun/bin/javaSet
javac.Enter this command:/usr/sbin/alternatives --config javacFollow the on-screen directions to ensure that the correct version ofjavacis selected. Table A.2, “javacalternative commands” shows the appropriate command settings for the different JDKs.Table A.2.
javacalternative commandsJDK alternative command OpenJDK 1.6 /usr/lib/jvm/java-1.6.0-openjdk/bin/javacSun Microsystems JDK 1.6 /usr/lib/jvm/java-1.6.0-sun/bin/javacExtra Step: Set
java_sdk_1.6.0.The Sun Microsystems JDK 1.6 requires an additional command be run:/usr/sbin/alternatives --config java_sdk_1.6.0Follow the on-screen directions to ensure that the correctjava_sdkis selected. It is/usr/lib/jvm/java-1.6.0-sun.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.