Tutorial:Update Java

This tutorial is exclusive to Java Edition.
 

As of Java Edition 1.21.11, 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 contains software and tools designed to develop Java applications, while JRE only contains the necessary parts to run one (excluding the development software and tools of JDK). 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.

As always, you should only use the latest version of Java supported by the game, which is Java 21 (supported from Java Edition versions 1.20.5 - 1.21.11). If you use custom JVM from an OpenJDK build, you should notice that Minecraft 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.
  • 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.[7]
  • 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 Java Edition server requires your computer to have Java installed instead of the pre-installed Java. See below on how to choose Java and installing them.

Choosing a Java

As mentioned before, you can get JVM from Java Runtime Environment (JRE) or Java Development Kit (JDK). They are usually distributed by a third-party vendor as an OpenJDK build. OpenJDK is the official open source reference implementation of Java, meaning it contains the software and tools required to run Java applications, such as JVM. Unlike the name suggested, an OpenJDK build does not strictly provide JDK, depending on the vendor, they may provide JRE-only build of OpenJDK.

OpenJDK builds

There are many third-party vendors that provide OpenJDK build which you can pick from:

  • Adoptium's Eclipse Temurin (successor of AdoptOpenJDK) – the most popular OpenJDK build. This is the best free open source OpenJDK build you can get out there, as it's well tested and it's sponsored by Microsoft and many other companies.
  • Azul's Zulu – stable and development builds provided by Azul.
  • Oracle's OpenJDK – stable and development builds provided by Oracle. It's technically the official builds, though packaged as ZIP archive without installer.
  • GraalVM – stable and development builds provided by Oracle. It uses high-performance compiler called Graal, though most of their advanced features and optimizations are only available in their enterprise and Oracle editions, which is paid and has restrictive license respectively. The Community edition is free and open source, but only few features are present. Do note the official website offers the Oracle edition, different from the Community edition on GitHub.

Long-term support (LTS)

You will see that Java is divided into long-term support (LTS) and short-term support (STS) versions:

  • The LTS versions of Java are updated for a long time but at specific, often older versions of Java. This provides better stability for long term, but at the cost of newer/experimental features from Java being absent.
  • The STS versions provide the new features, but are provided update for short time and quickly get outdated. This can cause instability and vulnerability if not checked.

These choices won't impact typical users, as the game will likely run fine with both versions, and you should just use the latest version that Minecraft currently support (see § What is Java?).

How to download

This part of the tutorial will show you how to get Java for specific operating systems and update them after installing. For simplicity, we will show you how to download Adoptium's OpenJDK build, Temurin.

Verify if you have Java installed

Before we install Java, you need to verify if you have Java installed on your system:

  • Open your system's terminal and run java -version to check your Java's version. If a version number is reported, and does not match the recommended version for Minecraft (see § Why update?), you should update Java from the tutorial below.
  • Alternatively for Windows, you can download Java Uninstall Tool. The software will check for your installed Java version, and removes older Java installation if necessary.

If you have older versions of Java installed before, you can remove it in your system's settings. Otherwise, you can install multiple Java or OpenJDK builds in your system, as recently installed Java will likely overwrite the previous version (in PATH variable, but for installation, they may exist coincide with each other).

Windows

You can install Java by downloading the installer from the vendors' website, e.g. Adoptium's OpenJDK Temurin or Microsoft build of OpenJDK. After downloading, you can run the installer and install Java normally.

Winget

Winget is the official Windows package manager for installing programs from Microsoft Store and the Winget repository. Its included in Windows 10 and Windows 11 by default.

You can install an OpenJDK build using Winget. You can choose either Temurin or Microsoft build of OpenJDK:

  • winget install EclipseAdoptium.Temurin.21.JRE for Adoptium Temurin 21 JRE-only.
  • winget install Microsoft.OpenJDK.21 for Microsoft build of OpenJDK 21.

Updating

If you have installed Java from the vendors' website and want to update it after a long time, you can download the newer installer file and update the software that way.

If you have installed Java from Winget, you can update Java by running:

  • winget upgrade <java-package>, where <java-package> is the name of OpenJDK you have installed before.

macOS

If you don't have OpenJDK, it can be installed using Homebrew package manager for macOS. Homebrew is a widely-used package manager for installing and updating software on macOS, including OpenJDK.

Homebrew is not installed by default on macOS, so you need to install it by running:

Then you can install OpenJDK by running:

  • brew install --cask temurin@21 for Adoptium Temurin 21.

Keep in mind that Temurin 21 only support macOS version 10.11 or greater. For older macOS versions, you can install other LTS versions, such as Java 17 and Java 11 from Temurin or other builds.

To update Java, you need to update Homebrew's package index and upgrade:

  • brew update && brew upgrade --cask temurin@21

Linux distributions

Linux comes in many different variation called distributions (distros). Each distribution has different ways and configurations of installing software and maintaining them, so it's recommended you visit and read their documentation of doing so. In general, Linux is more favorable to open source programs, so it is recommended you use open source programs where applicable, such as OpenJDK.

Upgrading a single software is usually not recommended on Linux systems, so if you want to update Java, you may want to do full package upgrade on your system.

Ubuntu, Raspbian, Debian-based

OpenJDK can be installed and updated by using apt:

  • Before installing, it is recommended to run sudo apt update.
  • sudo apt install openjdk-21-jdk for OpenJDK 21.
  • sudo apt install openjdk-8-jdk for OpenJDK 8.

Adding the -headless at the end of the package name will install headless Java and remove GUI components.

To update Java, it is recommended to run sudo apt update && sudo apt upgrade which will upgrade Java along other programs.

Fedora, AlmaLinux, Rocky Linux, CentOS, RHEL-based

OpenJDK can be installed using dnf:

  • sudo dnf install java-21-openjdk for OpenJDK 21.
  • sudo dnf install java-1.8.0-openjdk for OpenJDK 8.

Adding the -headless at the end of the package name will install headless Java and remove GUI components.

To update Java, it is recommended to run sudo dnf upgrade which will upgrade Java along other programs.

openSUSE

OpenJDK can be installed by using zypper:

  • sudo zypper install java-21-openjdk for OpenJDK 21.
  • sudo zypper install java-1_8_0-openjdk for OpenJDK 8.

For server usage, it is recommended to use openSUSE Leap rather than rolling-release Tumbleweed for stability.

To update Java, you can run the following commands depending on openSUSE editions:

  • sudo zypper update for openSUSE Leap, and
  • sudo zypper dup for openSUSE Tumbleweed.

Arch Linux

OpenJDK distributions are available on Arch Linux repository, and can be installed by using pacman:

  • pacman -S jre21-openjdk for OpenJDK 21.
  • pacman -S jre8-openjdk for OpenJDK 8.

Adding the -headless at the end of the package name will install headless Java and remove GUI components.

To update Java, it is recommended do a full update and upgrade of the packages in your system:

  • pacman -Syu to update Java along other packages.

If you encounter issues, it is recommended that you refer to the official Arch Linux Wiki.

Gentoo

Run emerge --ask virtual/jdk which installs OpenJDK according to your profile.

To update Java or specific versions, please refer to Gentoo Wiki.

Other distributions

Check your distro's documentation. It should have information on how to install OpenJDK.

Alternatively, you can visit Java's website directly to download the Java package for Linux. Most distros work with this (either 32 or 64-bit), but not usually recommended as your distro's package manager is more stable.

FreeBSD

OpenJDK can be installed in FreeBSD using pkg:[9]

  • pkg install openjdk21 for OpenJDK 21.
  • pkg install openjdk8-jre for OpenJDK 8 JRE-only.

Once you have installed OpenJDK, you may see OpenJDK requires fdescfs and procfs. In order to satistfy this requirements, you can run the following commands:

  • mount -t fdescfs fdesc /dev/fd for fdescfs mounted on /dev/fd.
  • mount -t procfs proc /proc for procfs mounted on /proc.

This changes are not permanent on the next system reboot. In order to make them permanent, you need to add these mountpoints to your /etc/fstab file. Open them with your text editor (such as nano or vi) and insert the following lines into /etc/fstab:

# device-spec   mount-point   fs-type   options dump
fdesc           /dev/fd       fdescfs   rw	    0	0
proc            /proc         procfs    rw	    0	0

Lastly, you will want to rehash to be sure that you can use your new Java binaries immediately, run rehash in the command line.

For installing OpenJDK using ports instead, please visit this website for more information. Packages from pkg are compiled binaries of the ports.[10]

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.

Legacy versions

  • The licensing change in January 2019 (8u211) is partially why the Minecraft Launcher (since Java Edition 1.16.5) is stuck at Java 8u51, instead of a newer Java 8 update. This problem has since been resolved with newer Java versions.
  • Java 9 to Java 16 (except Java 11) are no longer supported by Oracle: they no longer receive public security updates,[11] 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.[12]
    • Java 13, 15 is supported by source code, provides support in Azul Zulu.

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.[7] 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+.[13]
  • 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.[7]

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

Navigation