Our Discord Find a crew to play with. Join
Discord
Java for Minecraft
Guides / Optimization

Java for Minecraft: which version to install in 2026

Java is the engine Minecraft Java Edition runs on. The right Java version decides whether the game starts at all, and how stable and smooth it runs, especially with mods and big modpacks. In this guide you'll find a complete compatibility table, installation steps for Windows, macOS and Linux, an overview of the distributions (Temurin, Corretto, Azul Zulu), fixes for the most common errors, and tips on RAM and JVM arguments.

Last updated: November 12, 2026

What Java is and why Minecraft needs it

Java is a programming language and runtime environment created by Sun Microsystems (now Oracle). Minecraft Java Edition has been written in this language since its first version in 2009, so to run the game your computer needs a JRE (Java Runtime Environment): a set of libraries plus the JVM (Java Virtual Machine) that executes the game's code.

In practice, the JRE turns the game's bytecode into instructions your processor understands. The JVM also handles memory (the garbage collector), JIT (Just-In-Time) compilation and multithreading. That's why picking a good Java version with a well-configured JVM can make a real difference to your FPS, how smoothly chunks load and how long your world takes to load. You'll find more on optimization in our guide to Java arguments and in how to increase FPS in Minecraft.

Java Edition vs Bedrock Edition

Only Minecraft Java Edition needs Java. Bedrock Edition (Windows, Xbox, PlayStation, Switch, mobile) is written in C++ and doesn't use the JVM at all. If you play Bedrock, you don't need Java, but you also miss out on the huge world of mods, shaders and technical servers that only exist on Java Edition.

Why Java and not native code?

Java has two big advantages: portability (the same JAR runs on Windows, macOS and Linux without recompiling) and a huge mod ecosystem (Forge, Fabric, NeoForge, Quilt). The JVM is what lets mod developers swap out classes and change how the game behaves on the fly. The price of this flexibility, slightly higher memory use and a dependency on the JDK version, is one most players are happy to pay.

Do I have to install Java myself?

The short answer: usually not. The official Minecraft Launcher from Mojang automatically downloads and installs the right Java version for the game version you pick. Since Minecraft 1.17 the launcher has Java 17 built in, since 1.20.5 Java 21, and since 26.1 Java 25. For older versions (1.16.5 and below), the launcher downloads Java 8. It all happens in the background in the launcher's runtime folder, so you don't have to configure anything by hand.

So if you only play official Minecraft Java Edition with no mods and no third-party launchers, you can most likely skip this whole guide. Just sign in with your Microsoft account and click "Play". We cover the legitimate launchers and what they offer in our Minecraft launcher comparison.

Tip: If the official launcher won't start the game ("Game crashed", "Exit code 1"), the culprit is usually outdated graphics drivers or a conflict with your antivirus, not Java. Before you start installing Java by hand, update your drivers and check the logs in the .minecraft/logs folder.

When to install Java separately

There are situations, though, where the Java built into the official launcher isn't enough and a separate system-wide installation becomes necessary:

  • Modded servers: you start your own Forge, NeoForge, Fabric or Paper/Spigot server with java -jar server.jar. The server needs Java installed on the system.
  • Third-party launchers: Prism Launcher, MultiMC, the CurseForge App, ATLauncher and the Modrinth App use the Java installed on your system by default. Some can download it themselves (for example Prism since version 8.0), but they run more reliably on system Java.
  • Big modpacks: modpacks like RLCraft, All the Mods 9, Create: Above and Beyond and GregTech New Horizons often need special JVM arguments, more heap memory or the older Java 8 (for version 1.12.2).
  • Hosting: panels and hosts like Pterodactyl, Aternos, BisectHosting and Apex Hosting run on their own Docker images with a specific Java version. If you run a server, you need to know which Java version to pick.
  • Plugin development: if you write your own Paper/Spigot plugin or a Forge mod, you need the full JDK (not just the JRE).
  • Snapshots and experimental versions: new Java requirements show up there first. Java 25 arrived in 26.1 Snapshot 1 (December 2025), three months before the 26.1 release, so test servers and third-party launchers needed it before everyone else.

Minecraft vs Java version table

The table below lists the official Java requirements for every Minecraft Java Edition version from 1.7 to 26.x (as of October 2026). The versions listed are the minimum: newer builds of the same Java release (for example Java 21.0.4 instead of 21.0.2) work fine. Don't try to run 1.17 on Java 8, 1.20.5 on Java 17 or 26.x on Java 21, though: the game simply won't start and will throw an UnsupportedClassVersionError.

Minecraft version Minimum Java version Recommended Java version Built into the launcher
1.7 - 1.16.5Java 8Java 8 (Temurin 8.0.392+)Java 8
1.17 - 1.17.1Java 16Java 16 or 17 (LTS)Java 17
1.18 - 1.20.4Java 17Java 17 (Temurin 17.0.9+)Java 17
1.20.5 - 1.21.11Java 21Java 21 (Temurin 21.0.2+)Java 21
26.1 - 26.3 and 26.4 snapshotsJava 25Java 25Java 25

What do "Java 8", "Java 17" and "Java 21" mean?

Since version 9 (2017), Java has been numbered without the "1.x" prefix. Java 8 is really "1.8", and from Java 9 on, each number is the next major release. Versions marked LTS (Long Term Support), such as 8, 11, 17 and 21, are supported for at least 5 years, and those are the ones Minecraft players care about. Non-LTS versions (9, 10, 12-16, 18-20, 22) have shorter support and rarely end up in Minecraft.

Important: Since Minecraft 26.1 the game needs Java 25, and versions 1.20.5-1.21.11 need Java 21. An instance on Java 21 won't run 26.x, and an older modpack on Java 17 won't move to 1.21 until you update Java. This applies to both the client and the server.

JDK or JRE: which to choose

These are the two acronyms you'll see most often in the Java world:

  • JRE (Java Runtime Environment): contains the JVM, the standard libraries and everything you need to run Java programs. That's the minimum for a player.
  • JDK (Java Development Kit): the JRE plus a compiler (javac), diagnostic tools (jps, jstack, jstat), a profiler and documentation. You need it if you want to compile mods or plugins.

For a regular player, the JRE is all you need, and it takes up about 150 MB. The JDK takes up about 300-350 MB and is mainly useful for developers. Keep in mind, though, that since Java 11 Oracle no longer officially releases a separate JRE: only the JDK is available. That's why most players today actually use a JDK (for example Temurin 21 JDK), even if they only need the runtime.

What about jlink?

Some launchers (MultiMC, Prism) use the jlink tool to build a slimmed-down runtime that contains only the modules Minecraft needs. That cuts its size to about 80 MB. You don't have to deal with it yourself: the launcher does it automatically.

Java distributions: Temurin, Corretto, Zulu, Oracle, Microsoft

Java comes in many distributions, all built from the same open-source OpenJDK project. Each distribution adds its own patches, certifications and update policy, but underneath it's the same standard. For Minecraft they all work practically the same way; they differ mainly in license and support.

Distribution Vendor License Recommended for
Adoptium TemurinEclipse FoundationGPLv2 + CEMost players and servers: the de facto standard
Amazon CorrettoAmazonGPLv2 + CEServers on AWS, Linux
Microsoft Build of OpenJDKMicrosoftGPLv2 + CEWindows + Azure, education
Azul ZuluAzul SystemsProprietary (free for local use)ARM Macs (M1/M2/M3/M4), special architectures
Oracle JDKOracleNFTC (free since 17)Organizations that need official support
GraalVM CEOracleGPLv2 + CEExperiments with native images, not recommended for Minecraft

Why Adoptium Temurin is the default choice

The Minecraft community overwhelmingly recommends Adoptium Temurin for several reasons: it's completely free, updates come out quickly, the binaries are tested against the TCK (Java Technology Compatibility Kit), and the project is run by the neutral Eclipse Foundation. You can download it for free from adoptium.net. On Macs with Apple Silicon chips (M1/M2/M3), both Temurin and Azul Zulu work: both have native aarch64 builds.

Can I use Oracle JDK?

Yes. Starting with Java 17, Oracle introduced the NFTC license (No-Fee Terms and Conditions), which allows free use of Oracle JDK, including commercial use, as long as you follow its terms. For a player or a small community server this is no problem at all, but Temurin remains the safer licensing choice because it's pure OpenJDK under the GPL.

Installing Java step by step

Below are short instructions for the three most popular operating systems. The examples use Java 21 (Minecraft 1.20.5-1.21.11). For 26.x you install Java 25 the same way; only the version number in the file or package name changes.

Windows: the .msi file

  1. Go to adoptium.net and click "Latest LTS Release".
  2. Choose "Windows x64" and download the .msi installer (for example OpenJDK21U-jdk_x64_windows_hotspot_21.0.2_13.msi).
  3. Run the installer. In the "Custom Setup" step, enable these options: Set JAVA_HOME variable, Add to PATH and Associate .jar files.
  4. Click "Install" and wait for it to finish.
  5. Open CMD or PowerShell and check: java -version.

macOS: the .pkg file or Homebrew

The easiest way is with Homebrew:

brew install --cask temurin@21

Alternatively, download the .pkg file from adoptium.net (choose aarch64 for Apple Silicon, x64 for Intel Macs) and click "Open". Homebrew integrates better with the system PATH and makes it easier to keep several versions side by side.

Linux: apt, dnf, pacman

Adoptium has its own APT and YUM repositories. On Debian and Ubuntu:

sudo apt update && sudo apt install -y wget apt-transport-https gnupg
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo gpg --dearmor -o /etc/apt/keyrings/adoptium.gpg
echo "deb [signed-by=/etc/apt/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt update && sudo apt install -y temurin-21-jre

On Fedora and its derivatives:

sudo dnf install -y java-21-temurin

On Arch (from the AUR):

yay -S jre21-temurin

Checking the installation

After installing, whatever your system, open a terminal and type:

java -version

You should see something like this:

openjdk 21.0.2 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)

If you see "is not recognized as an internal or external command" instead, Java wasn't added to PATH. On Windows, uninstall it and run the installer again with the Add to PATH option enabled.

Several Java versions on one computer

If you play both classic modded Minecraft 1.12.2 on Forge and the latest 26.x version, you need two Java versions side by side (Java 8 and Java 25). If you also play 1.21.x modpacks, add a third one: Java 21. Just install the versions you need and tell the launcher which one to use for each profile.

Windows: the JAVA_HOME variable

On Windows, the easiest approach is to keep all your Java versions in C:\Program Files\Eclipse Adoptium\ (Temurin's default path) and switch between them with JAVA_HOME. Open Settings → System → About → Advanced system settings → Environment Variables, set JAVA_HOME to the full path of the Java folder you want (for example C:\Program Files\Eclipse Adoptium\jdk-21.0.2.13-hotspot) and add %JAVA_HOME%\bin to PATH.

In Prism, MultiMC, ATLauncher or the Modrinth App, though, you can skip JAVA_HOME: every instance has its own "Java path" field where you point to javaw.exe for that specific game version.

Linux: update-alternatives

Debian and Ubuntu use the update-alternatives system:

sudo update-alternatives --config java

You'll see a list of the registered Java versions: pick a number, and java -version will show the active one.

macOS and Linux: jenv or SDKMAN!

jenv (https://www.jenv.be/) lets you keep several Java versions side by side and switch between them per folder:

brew install jenv
jenv add /Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
jenv add /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home
jenv global 21
jenv local 8   # only in the current folder, e.g. in your 1.12.2 server folder

The alternative is SDKMAN! (https://sdkman.io/), a tool similar to jenv that also downloads versions for you automatically. Recommended mainly on Linux.

RAM for different setups

Java doesn't manage memory the way native applications do: it uses a garbage collector, and you set the size of the heap with the -Xmx argument. For Minecraft, you set the maximum memory in your launcher or in the start script. Here are practical recommendations for 2026:

Scenario Recommended RAM Argument
Vanilla 1.21, singleplayer2-3 GB-Xmx3G -Xms2G
Vanilla 1.21 with BSL / Complementary shaders4 GB-Xmx4G -Xms4G
50-100 mods (Fabric + Sodium)4-6 GB-Xmx6G -Xms4G
Big modpack (All the Mods 9, Create AaB)8-10 GB-Xmx10G -Xms8G
Very big modpack (GTNH, RLCraft 2.9)10-16 GB-Xmx16G -Xms10G
Vanilla server, up to 10 players4 GB-Xmx4G -Xms4G
Paper server, up to 50 players6-8 GB-Xmx8G -Xms6G
Modded server, 10 players (Forge 1.20)8-12 GB-Xmx12G -Xms8G
Important: Don't give Java all of your computer's RAM. Windows needs 3-4 GB for itself, the GPU and drivers. If you have 16 GB of RAM, give Java 10-12 GB at most and leave the rest for the system. Too high an -Xmx leads to long GC pauses and swapping, which ironically lowers your FPS.

Read more about choosing JVM arguments and switching from G1GC to ZGC in our article on the best Java arguments for Minecraft.

Java 8 vs 17 vs 21: performance differences

Newer Java versions aren't just newer syntax for programmers: they also bring real performance gains. Mojang didn't move Minecraft from Java 8 to 17 for cosmetic reasons. Here's what each major version changes:

Java 8 (2014): the classic for old modpacks

  • The default garbage collector is Parallel GC, with the option to switch to G1GC.
  • No modules (Jigsaw only arrived in Java 9), so a simpler structure.
  • Minecraft 1.12.2 and earlier run only on Java 8.
  • Remember to use Aikar's special flags: without them, GC can eat your FPS every few minutes.

Java 17 (2021): the first big step up from 8

  • The default is G1GC with a refined low-latency mode.
  • Better heap management and shorter GC pauses.
  • Introduced with Minecraft 1.17: it's why Caves & Cliffs didn't lag as badly as the 1.17 beta on Java 8.
  • Big speedups in math and I/O operations.

Java 21 (2023): the standard since 1.20.5

  • ZGC (Z Garbage Collector): GC pauses under 1 ms even with heaps of 100+ GB.
  • Virtual threads (Project Loom): a big performance boost for multiplayer servers, although the Minecraft client doesn't use them yet.
  • Better JIT compilation (new optimizations).
  • Minecraft 1.21 gets about 15-25% more FPS than 1.16.5 on the same machine, thanks to the move from Java 8 to 21.

If you play 1.17+, always choose the newest compatible LTS: there's no point staying on Java 16 or 17 when 21 is stable and faster.

The most common Java errors and how to fix them

"Could not find or load main class"

A typical error when starting a server or a mod launcher. The most common causes: a wrong path to the JAR file, a wrong class name in the script, or missing quotes around a path with spaces. The fix: in your start.bat / start.sh script, check that -jar server.jar points to a file that exists in the same folder.

"UnsupportedClassVersionError: ... has been compiled by a more recent version of Java Runtime"

The game or a mod was compiled with a newer Java than the one you're using. The fix: update Java to the version the mod needs (see the table above). The error details include the class file version: 52 = Java 8, 55 = Java 11, 61 = Java 17, 65 = Java 21, 69 = Java 25.

"Exception in thread 'main' java.lang.OutOfMemoryError: Java heap space"

The game ran out of the memory it was given. Raise -Xmx in the arguments (for example from 2 GB to 4 GB). If it's a big modpack, check the modpack's recommended RAM in its description on CurseForge / Modrinth.

"Error: Could not create the Java Virtual Machine"

Java couldn't reserve the memory it asked for. Most often the -Xmx is too high for the RAM you have. Lower the argument or close other programs.

"Exception in thread 'main' java.lang.NoSuchMethodError"

A mod is calling a method that doesn't exist in this Java version or in this version of the mod. Check that the mod is compatible with your game version.

"UnsupportedOperationException: The Security Manager is deprecated"

You'll see this when you try to run very old mods on Java 17+. Most mods for 1.12.2 and older really do need Java 8.

"Java binary not found" in Prism / MultiMC

The launcher couldn't find javaw.exe. Open Settings → Java and click Auto-detect, or enter the full path manually (for example C:\Program Files\Eclipse Adoptium\jdk-21.0.2.13-hotspot\bin\javaw.exe).

Tip: Before you go searching forums for the error, open the latest.log file in the .minecraft/logs folder. 9 times out of 10 you'll find the exact name of the missing mod or the conflict there.

Launchers, Prism and server hosting

Prism Launcher and testing Java versions

Prism Launcher (see our launcher comparison) has built-in automatic Java detection. Open Settings → Java and click Auto-detect: Prism scans your drive for every Java installation and shows you a list. You can then set a different Java, a different -Xmx and a different set of JVM arguments for each instance (per profile).

Since version 8, Prism can also download the Java you need by itself from Mojang's CDN or Adoptium if you enable the "Auto-install Java" option. It's a great solution for beginners.

Hosting: Pterodactyl, Aternos, BisectHosting

Pterodactyl: a self-hosted panel used by most Polish hosting companies. Every server runs in a Docker container with Java preinstalled. As the admin, you pick the image: ghcr.io/pterodactyl/yolks:java_21 for 1.20.5+, java_17 for 1.17-1.20.4, java_8 for 1.12.2. These versions are available without any extra configuration.

Aternos: free public server hosting. Aternos picks the Java version for your chosen game version by itself, so you don't have to think about it. Limits: 4 GB of RAM, and the server goes to sleep after 5 minutes with no players.

BisectHosting / Apex / ScalaCube: paid hosts. You pick the Java version from a list in the panel. The default is usually Java 21 or whatever matches the modpack you chose.

FAQ

Is Java for Minecraft free?

Yes. Adoptium Temurin, Amazon Corretto, Microsoft OpenJDK and Azul Zulu are free for personal and commercial use. Oracle JDK has also been free since version 17 under the NFTC license, although it has some restrictions for large companies.

Does Java slow down my computer when I'm not playing?

No. Java doesn't run any daemon or service in the background all the time. When you quit the game, the JVM shuts down. If you see the Java Update Service (Oracle JDK) after installing, you can disable it in services.msc.

Can I play 1.21 on Java 17?

No. Minecraft 1.20.5-1.21.11 needs Java 21, and the 26.x versions need Java 25. On Java 17 you'll get UnsupportedClassVersionError: class file version 65.

Can I play 1.12.2 on Java 21?

As a rule, no. Forge 1.12.2 uses libraries and reflection that don't work outside Java 8. There are workarounds (for example the "Better Foliage Java 17 Patch" mod), but they're risky. Definitely stick with Java 8 for 1.12.2.

Do I have to uninstall my old Java?

No, the new Java installs alongside it. On Windows it's worth uninstalling Java 7 and older (security vulnerabilities), but Java 8 is still needed for old modpacks.

Does Java 17 work on Apple Silicon (M1/M2/M3)?

Yes. Adoptium and Zulu have native aarch64 builds. x86_64 Java also works through Rosetta 2, but it's 10-20% slower. Always choose "aarch64" / "arm64".

Do I need to install Java if I play Bedrock?

No. Bedrock Edition is written in C++ and doesn't need Java.

Why does Minecraft need so much RAM?

Minecraft generates the world dynamically (chunk by chunk) and keeps entities, the texture atlas, the shader pipeline and a huge object graph in memory. Java adds GC overhead on top. For vanilla, 2 GB is enough, but mods and shaders can quickly eat up 8 GB.

Can I run Java in Docker?

Yes. For servers, we recommend the official Eclipse Temurin images (eclipse-temurin:21-jre) or the Pterodactyl images (ghcr.io/pterodactyl/yolks:java_21). For a 26.x server, choose an image with Java 25.

What does "hotspot" mean in the Java name?

HotSpot is the name of the JVM that Oracle/OpenJDK uses as its default virtual machine. It uses "hot spot compilation": frequently executed code is compiled to native code on the fly.

Summary

Java is the environment Minecraft can't start without. Luckily, Mojang's official launcher picks and downloads the right version by itself: Java 8 for 1.7-1.16.5, Java 17 for 1.17-1.20.4, Java 21 for 1.20.5-1.21.11 and Java 25 for 26.x. You mainly need to install Java by hand for third-party launchers (Prism, Modrinth App, MultiMC), your own servers and bigger modpacks. Go with Adoptium Temurin as your default distribution, stick to LTS versions (8, 17, 21) and Java 25 for 26.x, and set a sensible -Xmx. Remember that an UnsupportedClassVersionError always means the Java you have installed is older than the game needs: just update it and restart.