how to install java on redhat 9

Java is one of the most essential runtimes for developers, sysadmins, and security professionals. Many enterprise tools and applications require it, and on Red Hat Enterprise Linux 9 (RHEL 9), you can install it easily with a few commands. 

Step 1: Update System Packages

Before installing Java, make sure your RHEL 9 system is fully updated. This ensures compatibility and avoids broken dependencies. Run the following commands:  

sudo dnf update -y
sudo dnf upgrade -y

Keeping your system fresh also gives you the latest stable repositories for Java.

Step 2: Install Java Runtime Environment (JRE)

If you only need Java to run applications, the Java Runtime Environment (JRE) is enough. RHEL 9 provides OpenJDK packages for easy installation:

sudo dnf install java-17-openjdk -y

This will install OpenJDK 17, which is the default and recommended version on Red Hat 9 in 2025.

Step 3: Install Java Development Kit (JDK)

If you plan to compile or develop Java applications, you need the Java Development Kit (JDK). It includes the JRE plus developer tools like javac:

sudo dnf install java-17-openjdk-devel -y

With this package, you’re ready to build and run Java applications on RHEL 9.

Step 4: Verify the Java Installation

After installation, check if Java is installed correctly by verifying the version. Use the following commands:

java -version
javac -version

If both commands return version numbers, Java is successfully installed on your Red Hat Enterprise Linux 9 system.

Share:

More Posts

How to Install Maven on macOS 2025

What you will read?1 Check for Java Installation2 Install Homebrew (If Not Installed)3 Install Maven via Homebrew4 Verify Environment Variables (Optional)5 Create a Sample Maven

How to Use Google SMTP Server

What you will read?1 Step 1: Enable SMTP Access in Gmail2 Step 2: Secure Connection with TLS3 Step 3: Send an Email via SMTP4 Step

how to install wine on RHEL

What you will read?1 Check RHEL version and CPU architecture2 Update system and install base tools3 Verify subscription and enable CodeReady Builder4 Enable EPEL repository5

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments