|

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

You want toInstallWhere from
Run a Java 8 desktop programJava 8 runtime (offline installer)java.com
Build or run modern Java programsA JDK (Microsoft Build of OpenJDK is the quickest)Microsoft Learn
Use Oracle’s own JDKJDK 64-bit EXE or MSIoracle.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

  1. Right-click Start and choose Terminal.
  2. Type java -version and press Enter.
  3. 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

  1. Open the Microsoft Build of OpenJDK download page.
  2. Pick a long-term support release, then download the Windows x64 file ending in .msi or .exe, or the AArch64 file on an ARM PC.
  3. Double-click the file and follow the prompts.
  4. 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.

FeatureWhat it does
FeatureEnvironmentUpdates PATH (on by default)
FeatureJarFileRunWithAssociates .jar files with Java (on by default)
FeatureJavaHomeSets JAVA_HOME
FeatureOracleJavaSoftUpdates 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.

  1. Open the Java SE downloads page and accept the license.
  2. Download the Windows x64 installer, either the EXE or the MSI.
  3. Double-click it, approve the administrator prompt and follow the prompts.
  4. 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.

  1. Press Start, search for Environment Variables and open Edit the system environment variables.
  2. Click Environment Variables.
  3. Under System variables, click New, enter JAVA_HOME as the name and your JDK folder as the value.
  4. Select Path, click Edit and add %JAVA_HOME%\bin.
  5. 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 seeIt means
A version for both java and javacA full JDK is installed and on PATH
java works but javac is not recognizedOnly a runtime is installed
Not recognized for bothJava is missing from PATH, or the terminal is old
Version 1.8.0 when you expected 21Another 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.

Sources

Leave a Reply

Your email address will not be published. Required fields are marked *