How To Install Java On Windows 11 (2026)
This guide is for anyone who needs Java on a Windows 11 PC, either to run a Java program or to build one.
The first decision is which download you need, because Java for running apps and Java for development are different downloads.
Every step below comes from Microsoft’s and Oracle’s own pages, and the check at the end shows whether it worked.
Table of Contents
- Quick answer: which Java download do you need
- JRE vs JDK: what is the difference
- Check whether Java is already installed
- Install a JDK with winget (fastest)
- Install a JDK with the installer
- Installer options that matter
- Install silently on several PCs
- Install Oracle’s JDK instead
- Install the Java 8 runtime from java.com
- Set JAVA_HOME and PATH
- Check that it worked
- Fix the wrong Java version showing
- Uninstall Java
- Related Windows 11 guides
- Sources
- More Windows guides
Quick answer: which Java download do you need
| You want to | Install | Where from |
|---|---|---|
| Run a Java 8 desktop program | Java 8 runtime (offline installer) | java.com |
| Build or run modern Java programs | A JDK (Microsoft Build of OpenJDK is the quickest) | Microsoft Learn |
| Use Oracle’s own JDK | JDK 64-bit EXE or MSI | oracle.com |
If a program tells you exactly which Java version it needs, install that one.
JRE vs JDK: what is the difference
A runtime (JRE) runs Java programs, and a JDK is the full development kit that also includes the compiler.
Oracle’s installation guide puts it simply: to develop or run Java applications, download and install the JDK.
You can tell which one you have by running javac -version, which only works when a JDK is installed.
Check whether Java is already installed
- Right-click Start and choose Terminal.
- Type
java -versionand press Enter. - If a version prints, Java is already on the PC, and if you see “not recognized”, it is not installed or not on PATH.
Install a JDK with winget (fastest)
Microsoft’s Windows developer guide gives this command for the Microsoft Build of OpenJDK, which you can paste into PowerShell or Command Prompt.
winget install Microsoft.OpenJDK.21
The same guide gives this command if you prefer Eclipse Temurin.
winget install EclipseAdoptium.Temurin.21.JDK
The guide recommends Microsoft Build of OpenJDK or Temurin for most developers, and notes that Oracle JDK needs a license for commercial use.
Install a JDK with the installer
- Open the Microsoft Build of OpenJDK download page.
- Pick a long-term support release, then download the Windows x64 file ending in
.msior.exe, or the AArch64 file on an ARM PC. - Double-click the file and follow the prompts.
- Use only one install method per JDK version, because Microsoft says to uninstall first if you switch methods.
The download page lists the 25, 21, 17 and 11 long-term support lines today, so check it for the newest one.
Installer options that matter
Microsoft documents four optional features for its EXE installer, which you can set in the installer or in a silent command.
| Feature | What it does |
|---|---|
| FeatureEnvironment | Updates PATH (on by default) |
| FeatureJarFileRunWith | Associates .jar files with Java (on by default) |
| FeatureJavaHome | Sets JAVA_HOME |
| FeatureOracleJavaSoft | Updates the JavaSoft registry keys |
Turning on the JAVA_HOME feature saves you the manual steps in the section below.
Install silently on several PCs
Oracle’s guide gives these commands for its MSI, which you run from an elevated Command Prompt.
msiexec.exe /i jdk-21_windows-x64_bin.msi
msiexec.exe /i jdk-21_windows-x64_bin.msi /L C:\path\setup.log
The first command opens the basic installer, and the second writes a log you can scroll to the end of to confirm success.
Oracle also documents a silent mode for the EXE, which is the file name followed by /s.
Use the exact file name shown on the download page, because it changes with each release.
Install Oracle’s JDK instead
Oracle’s guide for Windows covers 64-bit systems and says administrator rights are required for both installers.
- Open the Java SE downloads page and accept the license.
- Download the Windows x64 installer, either the EXE or the MSI.
- Double-click it, approve the administrator prompt and follow the prompts.
- Delete the installer afterward to free disk space.
The default folder is C:\Program Files\Java\jdk-21 for JDK 21, and the number in the folder name follows the release you install.
The Oracle installer also places launchers for java, javaw, javac and jshell in a shared javapath folder, which is why the commands work from any terminal.
Oracle’s installer also creates a “latest” folder that points to the newest installed JDK of that feature release.
Install the Java 8 runtime from java.com
The java.com download is for end users who need Java to run desktop applications, and it currently offers Java 8.
The Windows page lists an online installer, an offline installer and a separate 64-bit offline installer.
The page notes that Java’s license changed for releases dated April 16, 2019 or later, so read it before you install on a work PC.
Set JAVA_HOME and PATH
Microsoft says Windows needs JAVA_HOME set manually, because tools such as Maven, Gradle and Android Studio depend on it.
- Press Start, search for Environment Variables and open Edit the system environment variables.
- Click Environment Variables.
- Under System variables, click New, enter
JAVA_HOMEas the name and your JDK folder as the value. - Select Path, click Edit and add
%JAVA_HOME%\bin. - Click OK on every dialog and open a new terminal.
If you want more detail on this screen, see our guide to editing environment variables and PATH in Windows 11.
The Microsoft installer can set both for you, because its EXE has options for updating PATH and for setting JAVA_HOME.
Check that it worked
Open a new terminal, since an old window will not see the change.
java -version
javac -version
echo %JAVA_HOME%
In PowerShell, use echo $env:JAVA_HOME for the last line.
| You see | It means |
|---|---|
| A version for both java and javac | A full JDK is installed and on PATH |
| java works but javac is not recognized | Only a runtime is installed |
| Not recognized for both | Java is missing from PATH, or the terminal is old |
| Version 1.8.0 when you expected 21 | Another Java is first on PATH |
Fix the wrong Java version showing
If several JDKs are installed, Microsoft says the one listed first in PATH takes precedence.
Oracle’s guide describes one known case, where installing JRE 8 after JDK 21 makes java -version report 1.8.0.
Oracle’s fix for that case is to uninstall and reinstall the JDK.
Uninstall Java
Open Control Panel, go to Programs and Features, and remove the Java entry.
If a failed uninstall blocks a new install, Oracle suggests running the Microsoft Program Install and Uninstall troubleshooter first.
For a ZIP install, delete the extracted folder and remove the JAVA_HOME and PATH entries you added.
Related Windows 11 guides
Sources
- Get started with Java on Windows (Microsoft Learn)
- Install the Microsoft Build of OpenJDK (Microsoft Learn)
- JDK installation on Windows (Oracle)
More Windows guides
- How To Install WSL (Linux On Windows) In Windows 11 (2026)
- How To Download And Install ADB On Windows (2026)
- How To Install Fonts In Windows 11 (2026)
- How To Install .NET Framework 3.5 On Windows 11 (2026)
- How To Uninstall ESET From Windows Step By Step (2026)
- How To Uninstall Kaspersky Completely From Windows (2026)
See all: Windows 11 Guides