# Java 17.x on Amazon Linux

This article provides step-by-step instructions for installing Java 17.x on an Amazon Linux 2023 system. Java is a critical component for running enterprise applications, middleware, and development tools. This guide ensures a clean, secure, and verified installation, suitable for production or development environments.

## Prerequisites

Ensure the following conditions are met before starting the installation:

* A running **Amazon Linux 2023 virtual machine** (EC2 or on-prem).
* A user account with **sudo privileges**.
* An **active internet connection** is required to download packages from the repository.

## Installation Steps

1. **Update the System Package Index**
   * Update the package manager to ensure that all existing packages and repository metadata are up to date.

     ```bash
     sudo yum update -y
     ```

     \
     *Sample Reference Screenshot:*

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

     <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>This step is essential to prevent conflicts or missing dependencies during Java installation.</p></div>

2. **Install Java 17 (Amazon Corretto)**
   * Use the following command to install **Amazon Corretto 17**, a free, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK).

     ```bash
     sudo yum install -y java-17-amazon-corretto
     ```

     \
     *Sample Reference Screenshot:*

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

3. **Verify the Installation**
   * After the installation completes, verify that Java 17 is installed and accessible from the command line:

     ```bash
     java --version
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="/files/gnHgAjBhYob3RvfSSCZM" alt=""><figcaption></figcaption></figure>
   * **Expected Output Example:**

     ```
     openjdk 17.0.x 202x-xx-xx LTS
     OpenJDK Runtime Environment Corretto-17.x.x.x (build 17.0.x+xx)
     OpenJDK 64-Bit Server VM Corretto-17.x.x.x (build 17.0.x+xx, mixed mode)
     ```

     <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>If the version output is displayed successfully, the Java installation is complete.</p></div>

***

Copyright © 2025, 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/deployment-and-maintenance/installation/java-17.x-on-amazon-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.
