Search

Chapter 2. Installing Prerequisite Components

download PDF

2.1. Install Open JDK on Red Hat Enterprise Linux

  1. Install the OpenJDK package:
    yum install java-[VERSION]-openjdk-devel
  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
    sudo alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-[VERSION]-openjdk/bin/javac 1000
  3. As root, run the alternatives command for java:
    /usr/sbin/alternatives --config java
  4. Select /usr/lib/jvm/jre-[VERSION]-openjdk/bin/java.
  5. Then do the same for javac:
    /usr/sbin/alternatives --config javac
  6. Select /usr/lib/jvm/java-[VERSION]-openjdk/bin/javac.
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.

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.

© 2024 Red Hat, Inc.