Java21 Upgrade (Linux)
This article describes the steps to upgrade Java to version 21 on a Linux machine. It outlines the installation process, configuration updates, and validation steps required to ensure the system uses the correct Java version. The procedure follows a structured approach aligned with standard deployment practices.
Prerequisites
Linux-based system with root or sudo access
Access to a package manager (e.g., yum)
Existing Java installation on the system
Terminal or command-line access
Steps Involved
Verify Existing Java Version
Run the following command to check the currently installed Java version:
java -versionSample Reference Screenshot:

Install Java 21
Execute the following command to install Java 21:
Sample Reference Screenshot:

Configure Java Alternatives
Run the following command to list and configure available Java versions:
From the displayed list, select Java 21 by entering the corresponding number, then press Enter. Sample Reference Screenshot:

Validate Java Upgrade
Verify that the system is using Java 21 by running:
Sample Reference Screenshot:

Copyright © 2026, OvalEdge LLC, Peachtree Corners, GA, USA.
Last updated
Was this helpful?

