How to Install Java on Windows 11

To install Java on Windows 11, download the Windows installer for the Java version your application or course requires, run it, then open a new Command Prompt and enter java -version. For Java development, install a Java Development Kit (JDK) and also check javac -version. Set JAVA_HOME only when your development tools need it.

The steps below use Microsoft Build of OpenJDK for native Windows 11. A separate section covers applications that specifically require Oracle Java 8. Java installed inside Windows Subsystem for Linux does not configure Java for Windows applications.

Choose the Java Version Before Downloading

Start with the requirements supplied by your app, project, or instructor. A program that specifies Java 17 or 21 should receive that major version unless its documentation explicitly allows another. Installing a newer release is not a reliable substitute for checking compatibility.

  • Writing or compiling Java programs: Choose a JDK. It supplies the runtime and development tools, including the javac compiler.
  • Running an existing application: Follow its runtime requirements. Some applications include their own runtime, so check their installation instructions before adding a separate one.
  • An app specifically asks for Java 8: Use its vendor-approved Java 8 distribution. The Java download at java.com serves Java 8; it is a different route from installing a current JDK.

For example, if a course requests JDK 21 and an unrelated desktop app requests Java 8, those are two requirements. Do not uninstall the app’s working runtime merely to simplify your developer setup.

Install a JDK With the Windows Installer

1. Check Your PC’s Architecture

Open Settings > System > About and look at System type. An x64-based processor uses the Windows x64 package; an ARM-based processor uses an ARM64/AArch64 package when the application supports it. Both are 64-bit, but they are different download choices. Our guide on how to tell if your computer is 32-bit or 64-bit in Windows 11 explains what each System type value means.

2. Download the Required JDK

Open the official Microsoft Build of OpenJDK downloads. Find the required major version, then select the Windows row, matching architecture, and exe installer. Microsoft provides versions including 25, 21, 17, and 11. Choose the current update within the required version.

Wait for the download to finish. A ZIP package requires manual extraction and configuration; choose the EXE for the graphical installation described here.

3. Run Setup and Note the Installation Folder

Close Java applications, open your Downloads folder, and double-click the installer. Review the publisher, any permission request, and the terms shown. Continue only if you agree; on a managed PC, contact your administrator if installation is restricted.

Follow the wizard and note the actual JDK folder. Keep the feature that adds Java tools to PATH enabled. Microsoft documents PATH setup as a default installer feature; JAVA_HOME is a separate optional feature. Finish setup before checking the commands.

Microsoft’s installation documentation advises using one installation method per JDK version. If that version is already installed through MSI or ZIP, review the documented migration instructions before switching methods. Do not stack installers to troubleshoot an unrelated application problem.

4. Verify Java and the Compiler

Close any existing terminal, search Start for Command Prompt, and open a fresh window. Run these separately:

java -version
javac -version

Both should display the major version you chose. The extra update numbers and vendor text can differ. If java works but javac does not, you may have a runtime without the compiler, or the terminal may be finding another installation. Use the troubleshooting checks below.

Set JAVA_HOME When a Tool Requires It

JAVA_HOME identifies the JDK’s main folder; PATH tells Windows where to find commands. Setting one does not automatically correct the other. Before changing existing variables, copy their values so you can restore them.

  1. Search Start for Edit the system environment variables, open it, and select Environment Variables. Our guide to opening environment variables in Windows 11 explains the user and system lists.
  2. Under System variables, select New, or edit an existing JAVA_HOME. System changes may require administrator permission. Set the name to JAVA_HOME and the value to the actual JDK folder containing bin.
  3. If PATH does not already point to this JDK’s bin folder, select Path > Edit > New and add %JAVA_HOME%\bin. Preserve unrelated entries.
  4. Select OK in each dialog. Open a new Command Prompt, run echo %JAVA_HOME%, and repeat both version checks.
Steps to set JAVA_HOME in Windows 11: open Environment Variables, add or edit JAVA_HOME, add %JAVA_HOME%\bin to Path, select OK and verify
Illustration: how to set JAVA_HOME in Windows 11.

Do not append \bin to the JAVA_HOME value itself. Do not copy an example folder name without checking that it exists. Microsoft’s Windows Java setup guide documents this configuration.

If Your Application Requires Oracle Java 8

Use this route only when the application’s instructions call for it. Oracle lists Windows 11 support for its 64-bit Java 8 downloads from update 311 onward. On an ARM PC, confirm the application and runtime’s supported architecture with the vendor.

  1. Follow Oracle’s Java 8 offline installation instructions to reach its manual download page. Select the Windows 64-bit offline download appropriate for the application.
  2. Save the installer, close applications, and open the downloaded file. Administrator access is required.
  3. Review the terms before selecting Install, and review any optional software choices. Complete setup and select Close.
  4. Reopen the application and check whether it finds the required runtime. Restart Windows if the installer requests it.

This installs a runtime for that use case; it does not supply the JDK compiler. Follow the app’s own verification instructions instead of assuming a successful JDK command means that app is configured.

Fix Common Installation Problems

Java Is Not Recognized

First open a new terminal. In Command Prompt, run where.exe java. Microsoft’s where command documentation explains that it searches the current folder and PATH. If it finds nothing, confirm setup completed and the installed JDK’s bin folder is in PATH.

The Wrong Version Appears

Run where.exe java and where.exe javac to see the matching locations. Compare those folders with the JDK you intended to use. An earlier Java entry can take precedence; an IDE may also have its own configured JDK.

Oracle documents a JDK 25/Java 8 PATH conflict in which installing Java 8 afterward changes the version returned by the command. Identify the installation involved before repairing it. Repeatedly downloading newer versions will not establish which executable your app uses.

A Working Java Command Does Not Fix the App

Check the application’s required major version, architecture, and runtime location. A command-line check establishes that this terminal can run Java; it does not establish compatibility for every application. Use the app’s settings or vendor support instructions to select its runtime.

Frequently Asked Questions

Do I Need JAVA_HOME Just to Run Java?

Not for the basic java -version check if PATH is already correct. Development tools may require JAVA_HOME, so use their requirements.

Should I Remove Older Java Versions?

Check which applications depend on them first. Remove an installation through its normal Windows uninstall entry only after confirming it is no longer needed. If your changes cause a problem, restore the environment values you copied and reopen the affected application.

Is Java the Same as JavaScript?

No. Installing Java does not enable JavaScript in a web browser. This guide configures Java applications and development tools on Windows.

Once the required version passes the checks, reopen your application or development tool and confirm that it uses the intended installation.

Join Our Free Newsletter

Featured guides and deals

You may opt out at any time.
Read our Privacy Policy