# 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 -version
  ```

  \
  Sample Reference Screenshot:

  <figure><img src="/files/jKUdsg4YGCqqbZO9rZOu" alt=""><figcaption></figcaption></figure>

### Install Java 21

* Execute the following command to install Java 21:

  ```
  sudo yum install java-21-openjdk-devel -y
  ```

  \
  Sample Reference Screenshot:

  <figure><img src="/files/jkjo0In9W5Ba6FZQTOtQ" alt=""><figcaption></figcaption></figure>

### Configure Java Alternatives

* Run the following command to list and configure available Java versions:&#x20;

  ```
  sudo update-alternatives --config java
  ```
* From the displayed list, select Java 21 by entering the corresponding number, then press Enter.\
  \
  Sample Reference Screenshot:

  <figure><img src="/files/P0FuovAs38KMzD1VemmF" alt=""><figcaption></figcaption></figure>

### Validate Java Upgrade

* Verify that the system is using Java 21 by running:

  ```
  java -version
  ```

  \
  Sample Reference Screenshot:

  <figure><img src="/files/su6ZkGAKidyBpCiqROJ5" alt=""><figcaption></figcaption></figure>

***

Copyright © 2026, OvalEdge LLC, Peachtree Corners, GA, USA.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ovaledge.com/release8.1/deployment-and-maintenance/upgrade/java21-upgrade-linux.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
