Installing Java on Linux
The Minecraft Launcher ships its own bundled Java runtime, so most players never need to install Java separately. You only need a system-wide Java install when the OptiFine .jar installer refuses to open, when you launch Minecraft through a third-party launcher, or when you run java -jar from a terminal.
Choose your OS
Which version of Java?
Modern Minecraft (1.18 and newer) needs Java 17 or later. Minecraft 1.21 and newer targets Java 21. For legacy Minecraft versions (1.16 and older), Java 8 is the safe choice. Both Eclipse Temurin and Amazon Corretto are free, well-tested distributions.
1. Install through your package manager
Use the OpenJDK package for your distribution:
# Debian / Ubuntu (Java 21)
sudo apt install openjdk-21-jre
# Fedora
sudo dnf install java-21-openjdk
# Arch
sudo pacman -S jre-openjdk2. Pick a default (multiple JDKs)
If you have several Java versions installed, switch the default with:
sudo update-alternatives --config javaVerify the install
Open a new terminal or command prompt and run:
java -versionYou should see a version string like openjdk version "21.0.4". If the command isn't found, the runtime isn't on your PATH — reopen your terminal or re-run the installer.