Install Java Yum Better (2026)

sudo alternatives --config java

sudo yum install java-1.8.0-openjdk

java -version

Find where Java is installed:

yum install oracle-java8-installer

For other distributions, download the RPM from Oracle JDK Downloads and install:

openjdk version "11.0.22" 2024-01-16 LTS OpenJDK Runtime Environment (Red Hat build 11.0.22+7-LTS) OpenJDK 64-Bit Server VM (Red Hat build 11.0.22+7-LTS, mixed mode, sharing) install java yum

yum package manager is the fastest way to get it running. Here is a straightforward guide to installing Java on your Linux system. Step 1: Update Your Package Repository Before installing new software, it is best practice to ensure your existing packages and repository metadata are up to date. bash sudo yum update -y Use code with caution. Copied to clipboard Step 2: Search for Available Java Versions You might want a specific version, such as Java 8, 11, or 17. To see what is available in your current repositories, run: bash yum list available java* Use code with caution. Copied to clipboard Step 3: Install Java Depending on your needs, you can install the general Java Runtime Environment (JRE) or a specific version of the OpenJDK. To install the default version: bash sudo yum install java -y Use code with caution. Copied to clipboard To install Java 8 (often required for legacy systems): bash sudo yum install java-

sudo yum install oraclelinux-release-el8 sudo yum install java-11-oraclejdk-devel

sudo yum install java-17-openjdk-devel

Check compiler (if JDK installed):

sudo yum install java-latest-openjdk