How to Install Java on Windows 11
Installing Java on Windows 11 is identical to Windows 10. The recommended approach in 2026 is either the Temurin MSI installer or a single winget command. Both set JAVA_HOME and PATH automatically.
Fastest method: winget
Open Windows Terminal or PowerShell as a normal user (no admin needed for winget):
winget install EclipseAdoptium.Temurin.21.JDK
Or Microsoft's build:
winget install Microsoft.OpenJDK.21
Close and reopen the terminal, then:
java -version
MSI installer method
- Visit adoptium.net. Click Latest LTS release.
- Download the
Windows x64 .msifile (about 180 MB). - Right-click the downloaded MSI and choose Install (you'll be prompted for admin confirmation).
- In the Custom Setup step, confirm that Add to PATH and Set JAVA_HOME are selected.
- Finish the install, then open a new PowerShell window:
java -version
javac -version
Windows 11-specific note: Windows Package Manager
Windows 11 ships with winget pre-installed as part of App Installer. If winget is missing or outdated, update it via the Microsoft Store (search "App Installer").
Verify JAVA_HOME is set
echo $env:JAVA_HOME
Should print something like C:\Program Files\Eclipse Adoptium\jdk-21.0.x.x-hotspot. If it prints nothing, set it manually:
[System.Environment]::SetEnvironmentVariable("JAVA_HOME","C:\Program Files\Eclipse Adoptium\jdk-21.0.x.x-hotspot","Machine")
(Replace the path with your actual install path, and run PowerShell as Administrator.)
Check which Java is active
where.exe java
Shows all java.exe binaries on PATH in priority order. The top one is what runs when you type java.
Setting Java per project in IntelliJ or VS Code
In IntelliJ: File > Project Structure > Project SDK — you can add any local JDK without changing the system PATH. In VS Code, install the Extension Pack for Java and configure java.jdt.ls.java.home in settings to point at your JDK installation.