Java21 Upgrade (Linux)
Was this helpful?
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.
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
Run the following command to check the currently installed Java version:
java -versionSample Reference Screenshot:

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

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:

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

Copyright © 2026, OvalEdge LLC, Peachtree Corners, GA, USA.
Was this helpful?
Was this helpful?
sudo yum install java-21-openjdk-devel -ysudo update-alternatives --config javajava -version
