Copied!
Laravel
Node

How to Set Up Java JDK on Windows (Step-by-Step Beginner Guide)

set-up-java-jdk-on-windows
Shahroz Javed
Dec 07, 2025 . 1.239k views

Setting up Java on Windows is the first step to running Java applications, building Spring Boot projects, or learning programming. This guide walks you through downloading the JDK, installing it correctly, configuring system variables, and verifying the installation — all using the latest methods recommended for 2025.

Introduction

Java Development Kit (JDK) contains everything you need to compile and run Java programs. Without proper installation and environment variable setup, commands like java and javac won't work. In this guide, we compare Oracle JDK and Adoptium (OpenJDK), then show how to configure them correctly on Windows.

💡 Related: Learn How to Install Node.js and Configure Environment Variables on Windows.

JDK Download Options

You can install Java from two popular and trusted sources: Oracle JDK or Adoptium Temurin (OpenJDK). Both support Java 21 and work on all modern Windows versions.

Oracle JDK (Official Release)

Download from:

Oracle JDK 21 for Windows

⚠️ Note: Oracle JDK may require a commercial license for certain business use cases.

Adoptium Temurin (OpenJDK – Free & Open Source)

Download from:

Adoptium Temurin JDK 21

Install the file named similar to: OpenJDK21U-jdk_x64_windows_hotspot_21.0.9_10.msi

Where Java Gets Installed

After installation, JDK files are typically stored inside:

Oracle Default Path

C:\Program Files\Java\jdk-21

Adoptium Default Path

C:\Program Files\Eclipse Adoptium\jdk-21.0.9+10

⚠️ If you used the Adoptium MSI installer, PATH is usually configured automatically.

Setting System Environment Variables

To make Java work globally in Command Prompt or PowerShell, you must configure JAVA_HOME.

Set JAVA_HOME for Oracle JDK

JAVA_HOME = C:\Program Files\Java\jdk-21
echo %JAVA_HOME%

Set JAVA_HOME for Adoptium Temurin

JAVA_HOME = C:\Program Files\Eclipse Adoptium\jdk-21.0.9+10

How to Add JAVA_HOME to PATH

Go to:

Windows Search → Edit the system environment variables → Environment Variables

  1. Under System Variables, create JAVA_HOME.

  2. Add the following to the PATH variable:

%JAVA_HOME%\bin

Verify Java Installation

After setting variables, verify the setup using these commands in Command Prompt:

Check Java Runtime

java -version

You should see output similar to:

openjdk version "21.0.9" 2025-10-21 LTS
OpenJDK Runtime Environment Temurin-21...
OpenJDK 64-Bit Server VM (build ...)

Check Java Compiler

javac -version

If you see something like javac 21.0.9, the compiler is working correctly.

Conclusion

Setting up Java on Windows is straightforward once you know where to download the JDK, how to configure JAVA_HOME, and how to verify the installation. Whether you choose Oracle JDK or Adoptium Temurin, both deliver full Java 21 functionality. After completing these steps, you're ready to develop Java applications, run Spring Boot, or learn Java programming.

💡 Read Also: How to Install Maven and Configure it with Java on Windows.
📑 On This Page