Show Table of Contents
2.3.3. Installation Procedures
Procedure 2.3. Installing Java
Follow this procedure to install and set up a supported Java version:
- Subscribe your system to the appropriate channel:
- Red Hat Enterprise Linux Server Supplementary for Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux Server Supplementary for Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux Supplementary for Red Hat Enterprise Linux 5
- On the command line, as the root user run the command to install Java 1.6 or 1.7:
- On Red Hat Enterprise Linux 5, Red Hat Enterprise Linux 6, and Red Hat Enterprise Linux 7, execute the
yum installcommand to install Java 1.6:# yum install java-1.6.0-<VENDOR>-devel
Substitute <VENDOR> withsun,ibm, oropenjdk.Execute the following variation of the listed command to install Java 1.7:# yum install java-1.7.0-<VENDOR>-devel
Substitute <VENDOR> withoracle,ibm, oropenjdk.
- Run the following commands as the root user (if switching from another user, make sure to run the command
su -) to make sure the correct JDK is in use:# alternatives --config java
# alternatives --config javac
These commands return lists of available JDK versions with the version in use marked with a plus (+) sign. If the set JDK is not the desired option, switch to the right JDK as instructed on the command line.Important
Any software that makes use of thejavaandjavaccommands is using the JDK set by alternatives. Switching java alternatives may negatively influence running of such software. - Install the required packages (see Section 2.3.2, “ZIP Installation Prerequisites”)

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.