Articles on: Minecraft
This article is also available in:

How to change the Java version your PC uses



Introduction



To compile plugin JARs, run older versions of Minecraft, and more, you may need different versions of Java. This guide explains how to install different Java versions and set the system to use a specific one!


☕ Downloading Different Java Versions ☕



For this guide, we will use Eclipse Temurin for Java versions and install Java 8. Go to Eclipse Temurin Releases and choose the following options:

Operating System: Windows
Package Type: JDK (JRE will not work for compiling plugins or running the game)
Architecture: x64 (most systems are x64; check your system information in the control panel if you're unsure)
Version: 8 (choose a different version if needed)



Download the .msi file and open it. Let it install the Java software. Do not change any options unless you are sure about it. Once done, the specific Java version you've chosen will be installed!

Java files will be in C:\Program Files\Eclipse Adoptium. Folders will be named like jdk-17.0.1.12-hotspot for Java 17, jdk-8.0.332.9-hotspot for Java 8, etc. Identify the correct version by these numbers.


📂 Using a Specific Java Version 📂



To specify a Java version, edit the environment variables on your PC. Start by opening Windows Run (Win + R or type "Run" in the search bar). Type sysdm.cpl and click OK. A window will pop up. Go to the "Advanced" tab and click on "Environment Variables".



In the "System variables" section, find the JAVA_HOME variable. Select it and click Edit. Click on "Browse Directory" and navigate to Program Files --> Eclipse Adoptium. Choose the folder of the Java version you want to run and click OK.



In our case, the variable value is C:\Program Files\Eclipse Adoptium\jdk-8.0.332.9-hotspot. Click OK on all windows until the system properties window is closed.

Verify the correct Java version by opening Command Prompt and typing java -version. In our case, it shows Java 8, as expected!

openjdk version "1.8.0_332"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_332-b09)
OpenJDK 64-Bit Server VM (Temurin)(build 25.332-b09, mixed mode)



🎮 Choosing the Version in Your Minecraft Launcher 🎮



To change the Java version used in Minecraft, open the Minecraft launcher. Go to the "Installations" tab. Click the three dots on the installation you want to edit and click "Edit".

Scroll down, hit "More options," and then click "Browse" in the "Java executable" field to choose a Java version. Select the javaw.exe file, usually found in the Java folder (jdk-8.0.332.9-hotspot) --> bin --> javaw.exe. Click "Open" and then save your installation. You will have chosen the Java version for Minecraft.




Conclusion



You now know how to choose the Java version for compiling plugins, running server software, or playing Minecraft on different versions!

Updated on: 30/05/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!