# Setup: Install the Java 25 JDK

Install the Java Development Kit (Eclipse Temurin 25) and set JAVA_HOME on Windows.

Novice · Operating System · Java · Updated November 16, 2026

By Gregor Dzierzon

## After this lesson you can

- Install a JDK and check the versions of java and javac
- Set the JAVA_HOME environment variable

**Windows only.** The **Java Development Kit (JDK)** contains everything you need to build and run Java programs. It includes `javac`, which compiles your code, and `java`, which runs it.

We use **Java 25**, a long-term support (LTS) release, in the **Eclipse Temurin** build. Temurin is a free build of Java from the Eclipse Foundation.

Some tools, such as the Maven build tool you will use later, look for Java in a setting called `JAVA_HOME`. An **environment variable** is a named value that every program can read. The Temurin installer can set `JAVA_HOME` for you, but only if you ask, so you will run it with `--interactive`.

## Install the JDK

In Git Bash, run:

```bash
winget install -e --id EclipseAdoptium.Temurin.25.JDK --interactive
```

The Temurin installer opens.

1. Click **Next** on the welcome page.
2. On the **Custom Setup** page, find **Set JAVA_HOME variable**. It has a red **X** beside it, which means it will not be installed. Click the **X** and choose **Will be installed on local hard drive**.
3. Leave **Add to PATH** as it is (it is already set to be installed).
4. Click **Next**, then **Install**. Click **Yes** if Windows asks whether the app may make changes.
5. Click **Finish**.

## Check your work

Close Windows Terminal completely and open it again, so Git Bash sees the new settings. Then run:

```bash
java -version
javac -version
echo $JAVA_HOME
```

`java -version` prints three lines. The first starts with `openjdk version "25`, and the second names `Temurin-25`. `javac -version` prints `javac 25` followed by more numbers. The numbers after `25` change with each update, so yours may differ from the ones shown here.

`echo $JAVA_HOME` prints a path that contains `Eclipse Adoptium` and `jdk-25`.

## Common problems

| What you see | What to do |
|---|---|
| `bash: java: command not found` | Close every Windows Terminal window and open a new one. If it still fails, sign out of Windows and back in. |
| `java -version` shows an older version, such as 17 or 21 | Another JDK is installed and comes first. Open **Settings**, go to **Apps > Installed apps**, and uninstall the older Java, then open a new terminal. |
| `echo $JAVA_HOME` prints an empty line | **Set JAVA_HOME variable** was not chosen. Open **Settings > Apps > Installed apps**, find **Eclipse Temurin JDK with Hotspot 25**, click **...** and choose **Modify**. Choose **Change**, turn on **Set JAVA_HOME variable**, finish the installer, then open a new terminal. |

Source: https://www.ask-codey.com/lessons/os-and-terminal-tools-windows-setup-java-jdk
