What version of java should I use for Minecraft?

I am running minecraft on 12.04 by following these steps:

A. Open a terminal, and enter

sudo apt-get purge openjdk*

This is a "housekeeping" step that may or may not apply to your setup.

B. Install OpenJDK6 or OpenJDK7 from the Ubuntu Software Center.

C. I prefer following the instructions to install minecraft found at http://debianhelp.wordpress.com/2012/05/22/how-to-install-minecraft-on-ubuntu-12-04-lts/.

It neatly integrates launching the game into Unity, and it opens like any other application (so no right-clicking to run the file). Only follow the last two steps in the tutorial ("Download and untar installation bash script" and "To install Minecraft Client").

D. After installing everything, I would recommended you update the LWJGL files using the link and instructions found at http://www.minecraftwiki.net/wiki/Tutorials/Update_LWJGL (essentially what Minecraft uses for graphics, sound, and input).

This update should prevent some common issues that bugged me (i.e., sound cutting out while running the game). CAUTION: be sure to back up the files you're updating with the new LWJGL files, just in case.

If you are playing Minecraft 1.18 - Java Edition (released on 30 November 2021) and wondering which Java version it is based on? It's Java 17.

Java version 17 was released in the last year on 14 September 2021.


Minecraft now uses Java version 17. If you are using a default setup, the Launcher will download and install the correct version. If you are using a custom Java setup, or a third-party launcher, you will need to ensure that your Java installation is version 17 or above.

Source: https://feedback.minecraft.net/hc/en-us/articles/4415128577293-Minecraft-Java-Edition-1-18

Which version of JDK do I need to write Minecraft mods for the current version of Minecraft and Forge?

It depends on your Minecraft version.

"Starting from Minecraft 1.12, Java 8 will be required to run Minecraft. If you don't know whether you have Java 8, don't worry - our installers supply Minecraft with its own version of Java by default."

Source: https://minecraft.net/en-us/get-minecraft

"Starting from Java Edition 1.17, Java 16 is required to run Java Edition. If the player does not know whether they have Java 16, the Minecraft launcher supplies Java Edition with its own version of Java by default."

Source: https://minecraft.fandom.com/wiki/Java_Edition#Software

Notes:

  1. The above information is a direct quote from sources that should be reliable. However, the quotes (and the sources) are liable to become out of date, so check the links for updates!

  2. While you can (technically) develop on a later version of Java than the Minecraft platform uses, you will need to build with that version or older as the target Java version. A JVM will not run bytecodes with a more recent classfile version number. You will get a classloader error.

  3. Beware of using preview features in your mods. If you use them, then the platform has to be run with preview features enabled, or you will get classloader errors.

Oracle says that the latest JDK is 17 (like, I've only been away from Java for like 3 years... how the hell are they chewing through version numbers like this, ugh).

They have moved to a release cadence of one new release every 6 months. Certain releases are designated LTS releases (8, 11, 17). Other releases go end of life immediately on the release of following one.

Since Java 17 LTS was released a couple of weeks ago (at time of writing), both Java 16 and Java 15 are end of life.

I installed Minecraft 1.14.3 but can't run it.
I don`t know which Java to choose for it to work.

0

As of as of late 2021 ANY java version that is not officially used with that version will NOT work, there is currently no workaround.

Updating Java is important to do as a Minecraft player, as some technical bugs may be fixed only by updating Java.

As of Minecraft Java Edition 1.18, the Minecraft launcher is bundled with Java version 17.0.3. It is possible to change the used Java version in the profile options menu.

What is Java?[]

Java is a programming language and computing platform. Unlike many other languages, Java does not run directly on the hardware, but in a virtual machine, called the JVM (Java Virtual Machine).[1] Minecraft is written in Java, and uses it for game logic, rendering, and networking.

As of May 7, 2022, the latest stable Java versions are 1.8.0_333 (Oracle JDK) / 1.8.0_332 (OpenJDK) (Long-Term Support or LTS), 11.0.15 (LTS), 17.0.3 (LTS) and 18.0.1 (Short-Term Support or STS), while the latest development build is version 19 early-access build 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.[2]

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.

Where to download[]

See also: Wikipedia:OpenJDK § OpenJDK builds

You can get Java either from Oracle or from someone who builds OpenJDK. For the purpose of Minecraft they are essentially the same, but Oracle's "OTN" version (Oracle JDK uses "Oracle No-Fee Terms and Conditions" as of Java 17 LTS) requires a PAID license for commercial and production purposes. If you make money from streaming Minecraft or running a Minecraft server (even non-profit), you MUST use OpenJDK unless you want to figure out how to pay.

  • Adoptium OpenJDK (Continuation of AdoptOpenJDK)(stable builds only, check github.com/adoptium for development builds)
  • AdoptOpenJDK (stable and development builds)(From July 2021 no new JDKs will be produced. All production of further builds has been moved to adoptium.net)
  • Zulu OpenJDK (recommended) (stable and development builds)
  • Oracle OpenJDK (stable and development builds) - zip packages only (no installer)
  • Oracle JRE (NOT recommended unless you want to pay) (stable "OTN" builds)

You will see that Java is divided into LTS (long-term support) like 11 and STS (short-term support) version numbers like 16. An LTS version 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[]

With sources like AdoptOpenJDK you might see a choice between HotSpot VM and something else. The VM is what actually executes the Java code, and HotSpot is the one written by Oracle and used in "official" releases. Some other VMs include:

  • IBM's OpenJ9, optimized for low memory and fast startup
  • Oracle's GraalVM, also optimized for low memory and fast startup

GraalVM is usually included in HotSpot in the form of "JVMCI" in JDKs 10 - 16.[7][8] OpenJ9 takes a separate download.

Notes[]

  • The licensing change in January 2019 (8u211) is partially why Minecraft's 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,[9] 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.[10]
    • 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 the 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.

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+.[11]
  • 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] Funnily enough, the current minimum GPU requirement for Minecraft appears to be Intel HD4xxx graphics, which would make this fix from Mojang seem obsolete as Java 8u211 could potentially offer more stability if they implemented it.

References[]