Installing Java on Windows
The Minecraft Launcher ships its own bundled Java runtime, so most players never need to install Java separately. You only need a system-wide Java install when the OptiFine .jar installer refuses to open, when you launch Minecraft through a third-party launcher, or when you run java -jar from a terminal.
Choose your OS
Which version of Java?
Modern Minecraft (1.18 and newer) needs Java 17 or later. Minecraft 1.21 and newer targets Java 21. For legacy Minecraft versions (1.16 and older), Java 8 is the safe choice. Both Eclipse Temurin and Amazon Corretto are free, well-tested distributions.
1. Download the installer
Grab an MSI installer for your architecture (x64 on most PCs) from Eclipse Temurin. Pick the JRE package for the Java version Minecraft needs.
2. Run the installer
Double-click the .msi. On the Custom Setup screen, enable Add to PATH and Associate .jar files — this is what lets you double-click the OptiFine installer.
3. Restart open windows
Close and reopen any command prompt or PowerShell window so the new PATH takes effect.
Verify the install
Open a new terminal or command prompt and run:
java -versionYou should see a version string like openjdk version "21.0.4". If the command isn't found, the runtime isn't on your PATH — reopen your terminal or re-run the installer.