How to Install Java for Minecraft Java Edition

Since 2021, the official Minecraft Java Edition launcher ships with its own bundled JRE β€” you do not need to install system Java just to play Minecraft. However, older launchers, mods and development tools often require a system Java. Here is what to install for each scenario.

Do you need to install Java for Minecraft?

ScenarioNeed system Java?
Minecraft Java Edition via the official Mojang launcher (2021+)No β€” launcher bundles Java automatically
Running a Minecraft server (server.jar)Yes β€” Java 21 for 1.21+, Java 17 for 1.17–1.20
MultiMC, Prism Launcher or other third-party launchersYes β€” configure Java path in launcher settings
Minecraft mods via Forge or FabricSometimes β€” depends on launcher
Developing Minecraft plugins (Spigot/Paper)Yes β€” JDK required

Which Java version for Minecraft?

  • Minecraft 1.21+ requires Java 21
  • Minecraft 1.17–1.20 requires Java 17
  • Minecraft 1.12–1.16 requires Java 8 (or Java 11 for some builds)
  • Minecraft below 1.12 requires Java 8

Install Java 21 for Minecraft server or modded play

Windows:

winget install EclipseAdoptium.Temurin.21.JRE

(Install the JRE for runtime-only; install the JDK if you also develop plugins.)

macOS:

brew install openjdk@21

Ubuntu:

sudo apt install openjdk-21-jre

Verify:

java -version
# openjdk version "21.0.x"

Running a Minecraft server

java -Xmx4G -Xms1G -jar server.jar --nogui

-Xmx4G sets the maximum heap to 4 GB. Adjust to about 70% of available RAM for a dedicated server machine. For Paper servers, the recommended JVM flags are published at docs.papermc.io/paper/aikars-flags β€” they meaningfully improve garbage collection pause times.

Configure Java path in Prism Launcher

  1. Open Prism Launcher > Settings > Java
  2. Click Auto-detect β€” it scans common install paths.
  3. Select the Java 21 entry and click OK.
  4. You can set Java per instance: right-click an instance > Edit > Settings > Java > override global setting.

Memory allocation tips

Minecraft is more memory-bound than CPU-bound. For single-player, 4 GB (-Xmx4G) is plenty with mods; 2 GB is fine vanilla. Giving the JVM more memory than it needs does not help β€” it just delays garbage collection and causes longer pauses. The G1GC (default since Java 9) handles Minecraft well; you only need to tune it if you see lag spikes from GC on a busy server.