Chapter 2. Installing Prerequisite Components


2.1. Install Open JDK on Red Hat Enterprise Linux

  1. Install the OpenJDK package:
    yum install java-[VERSION]-openjdk-devel
    Copy to Clipboard Toggle word wrap
  2. To install it to alternatives, run these commands:
    sudo alternatives --install /usr/bin/java java usr/lib/jvm/java-[VERSION]-openjdk/bin/java 1000
    Copy to Clipboard Toggle word wrap
    sudo alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-[VERSION]-openjdk/bin/javac 1000
    Copy to Clipboard Toggle word wrap
  3. As root, run the alternatives command for java:
    /usr/sbin/alternatives --config java
    Copy to Clipboard Toggle word wrap
  4. Select /usr/lib/jvm/jre-[VERSION]-openjdk/bin/java.
  5. Then do the same for javac:
    /usr/sbin/alternatives --config javac
    Copy to Clipboard Toggle word wrap
  6. Select /usr/lib/jvm/java-[VERSION]-openjdk/bin/javac.
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat