Tutorial:Update Java
As of Java Edition 1.21.10, the Minecraft Launcher is bundled with the Microsoft build of OpenJDK (Java SE 21). If need be, it is possible to change the used Java version in the profile options menu.
What is Java?
Java is a programming language where the entire game of Minecraft: Java Edition is written in. It is designed to create applications that run on Java Virtual Machine (JVM), which is supported across different platforms. Because of this, developers can write a Java application and any platform that supports JVM can run the same Java application in their environment (write once, run anywhere). Notably, this makes the game supported on Windows, macOS, and Linux systems.
In order to run Minecraft: Java Edition, you would need the JVM software. It is typically bundled in Java Development Kit (JDK) or Java Runtime Environment (JRE). Both can be used to run the game, but JDK is specifically designed to develop Java applications, while JRE only contains the necessary parts to run one. This makes JDK a bit bigger than JRE, so if you aren't planning to do Java development anytime soon, you shouldn't need JDK.
You should only use LTS versions of Java, as they provide important security updates. You can also use the latest version of Java supported by the game (usually, they are the LTS versions). The latest version of Java supported by Minecraft: Java Edition (≥ 1.20.5 and 1.21) is Java 21.
If you use a custom JVM, you should notice that the official launcher only allow the custom JVM with the same primary Java version as the minimum required Java version to launch the game.[1]
Why update?
The latest versions of Java contain important enhancements to help improve performance, stability and security of the Java applications that run on your machine. Installing the latest Java update ensures that Minecraft continues to run safely and efficiently.
- Different Minecraft versions have different requirements of minimum Java version.
- From the first version of Minecraft, Java Edition pre-Classic rd-132211 to Java Edition 1.5.2, Minecraft requires Java 5 (1.5.0) or newer.
- From Java Edition 1.6.1 (13w16a) to Java Edition 1.11.2 (1.12: 17w06a), Minecraft requires Java 6 (1.6.0) or newer.
- From Java Edition 1.12 (17w13a) to Java Edition 1.16.5 (1.17: 21w18a), Minecraft requires Java 8 (1.8.0) or newer.[2]
- From Java Edition 1.17 (21w19a) to Java Edition 1.17.1 (1.18: 1.18 Pre-release 1), Minecraft requires Java 16 or newer.[3]
- From Java Edition 1.18 (1.18 Pre-release 2) to Java Edition 1.20.4 (1.20.5: 24w14potato), Minecraft requires Java 17 or newer.[4]
- Since Java Edition 1.20.5 (24w14a), Minecraft requires Java 21 or newer.[5]
- Minecraft may sometimes crash without being run by a relatively modern version of Java.
- Java updates fix lots of problems and bugs and typically cause increases in performance.
- For example, the newer garbage collectors can help with lag spikes during high memory usage.[6]
- Older versions of Minecraft can run on newer Java, for example, Minecraft 1.16 can run on Java 17, Minecraft 1.18 can run on Java 20, and etc.
- But this may cause some instability if not run with the right version of Java, especially versions that require Java ≤8.
- Running a server requires your computer to have Java installed instead of the pre-installed Java. See Tutorial:Setting up a Java Edition server for more information.
Where to download
You can get JDK or JRE that is distributed by a third party vendor, they are called OpenJDK builds. OpenJDK is the official open source reference implementation of Java. Note an OpenJDK build may provide JDK or JRE, not strictly JDK itself.
- Microsoft build of OpenJDK – the official and tested OpenJDK build for Minecraft. It is bundled with Minecraft Launcher and is available for commercial purposes.
- Adoptium's OpenJDK Temurin, continuation of AdoptOpenJDK – one of the most popular OpenJDK distributions. Microsoft also sponsors Adoptium so you can assume this is also well tested. Provide stable and development builds on Adoptium's GitHub.
- Azul's OpenJDK Zulu – stable and development builds.
- Oracle's OpenJDK – stable and development builds, though packaged as ZIP archive without installer.
- Oracle JDK (Java SE Development Kit) – stable builds, but requires Oracle Technology Network (OTN) license for Java 11-16 and Non-Fee Terms and Conditions (NFTC) for Java ≥17. It is not recommended unless you want to follow their restrictive license for production and commercial use (which likely covers running a Minecraft server).
You will see that Java is divided into LTS (long-term support) like Java 17, Java 21, etc., and STS (short-term support) version numbers like Java 16. The LTS versions will be given updates for longer, so people tend to use them as a stable standard of "modern, but not too new" Java.
Other VMs
Some other Java compatible VMs include:
- IBM's Semeru (was open-sourced as Eclipse OpenJ9), IBM in-house JVM with low memory footprints and faster startup
- Oracle's GraalVM, based on OpenJDK, similiar to Semeru, has low memory footprints and faster startup
Notes
- The licensing change in January 2019 (8u211) is partially why Minecraft's 1.16.5 official launcher is stuck at 8u51, instead of a newer Java 8 update.
- Java 9 to Java 16 (except Java 11) are no longer supported by Oracle: they no longer receive public security updates,[7] and are to be regarded as insecure. Oracle has removed them from its download page but the builds are still available in the Java Archive. Oracle does not recommend using builds from the Java Archive.[8]
- Java 13, 15 is supported by source code, provides support in Azul Zulu.
How to update
When you install Java, go to your launcher, edit or create an installation, and in the Java Executable box, type C:\Program Files\Java\jvm-[version]\bin\javaw.exe (Windows)
or: /usr/lib/jvm/(java version)/bin/java (Linux) or: /usr/bin/java (macOS). The exact value depends on where your java is installed.
You must remove -XX:+CMSIncrementalMode from your JVM Arguments. This option is meaningless for Java 9 and newer, and will cause a launch failure if you keep it there.
Notes
- Because the official launcher has Java integrated, you won't need to download and install Java unless you are using third-party launchers instead.
- If your computer runs a 64-bit operating system, it's recommended to install the 64-bit Java for better performance.
- Administrator privileges are required when installing on some systems.
Issues
Known issues
- In Java 11 or newer, a very rare crash may occur in world generation code (MC-149777). A fabric mod called Voyager exists to fix this issue.[6] If you are using Fabric API 0.26.2 or above, this mod is not needed as the fix is included. This bug was fixed in 1.17 snapshot 21w20a and hence does not exist from 1.17+.[9]
- Do not upgrade if you are using Intel HD2xxx/3xxx graphics on Windows 10, as the driver is bugged. Java 8 uses a slower rendering method that makes it work, and that is mainly why Mojang stuck to this old version.[6]
Other issues
Issues relating to "Java lang", "Java server", "GC", "Lwjgl", "JVM", or "Exception" are maintained on the bug tracker. Issues should be reported and viewed there.
References
- ↑ MCL-18306
- ↑ "Heads up modders: This snapshot is the first Minecraft version to require (and therefore use) Java 8. You can now finally use 7/8 features!" – @Dinnerbone (Nathan Adams) on X (formerly Twitter), January 30, 2017
- ↑ "Minecraft Snapshot 21w19a" – Minecraft.net, May 12, 2021.
- ↑ "Minecraft 1.18 Pre-Release 2" – Minecraft.net, November 16, 2021.
- ↑ "Minecraft Snapshot 24w14a" – Minecraft.net, April 3, 2024.
- ↑ a b c jellysquid3's Java Update / ZGC Guide
- ↑ "Oracle Java SE Support Roadmap" – oracle.com.
- ↑ "Java Archive" – oracle.com.
- ↑ Fix MC-149777 - java.util.ConcurrentModificationException when using Java 11 or above