2.3. Install OpenJDK on Red Hat Enterprise Linux

Procedure 2.1. Install OpenJDK on Red Hat Enterprise Linux

  1. Subscribe to the Base Channel

    Obtain the OpenJDK from the RHN base channel. Your installation of Red Hat Enterprise Linux is subscribed to this channel by default.
  2. Install the Package

    Use the yum utility to install OpenJDK:
    $ sudo yum install java-1.6.0-openjdk-devel
    
  3. Verify that OpenJDK is the System Default

    Ensure that the correct JDK is set as the system default as follows:
    1. Log in as a user with root privileges and run the alternatives command:
      $ /usr/sbin/alternatives --config java
    2. Depending on the OpenJDK version, select /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java.
    3. Use the following command to set javac:
      $ /usr/sbin/alternatives --config javac
    4. Depending on the OpenJDK version used, select /usr/lib/jvm/java-1.6.0-openjdk/bin/java or /usr/lib/jvm/java-1.7.0-openjdk/bin/java.