此内容没有您所选择的语言版本。
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
Installing a Java Development Kit from the Red Hat Network will normally result in an automatically configured system. However, if multiple JDKs are installed, it is possible that
/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.Expand Table A.1. java alternative commands JDK 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.Expand Table A.2. javac alternative commands JDK 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.