I am trying to run minecraft on popos, I have openjdk-19-jre-headless but I get " java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 63.0", what do I need to apt get to run this?
Assistant
The error message you're encountering indicates that the version of Java Runtime Environment (JRE) you have installed is older than the version required by the Minecraft application you're trying to run.
Here's the key part of the error message:
code
java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 63.0
Explanation:
Class file version 65.0 corresponds to Java 21.
Class file version 63.0 corresponds to Java 19.
This means that the Minecraft version you're trying to run requires Java 21, but you currently have Java 19 installed.
Solution: Install Java 21
To resolve this issue, you'll need to install OpenJDK 21 on your Pop!_OS system.
Step-by-Step Guide:
1. Remove Existing Java Versions (Optional but Recommended)
First, it's a good idea to remove older versions of Java to prevent conflicts.
bash
sudo apt remove openjdk*
sudo apt autoremove
2. Add the OpenJDK PPA
Since OpenJDK 21 might not be available in the default repositories of Pop!_OS (which is based on Ubuntu), you can add a PPA (Personal Package Archive) that provides the latest OpenJDK packages.
Note: As of my knowledge cutoff in September 2021, OpenJDK 17 was the latest LTS version. However, since your error message refers to Java 21, and considering the date (2023-10), we'll proceed accordingly. If the ppa:openjdk-r/ppa doesn't have Java 21, you'll need to install it manually or use an alternative method provided below.
3. Install OpenJDK 21
Try installing OpenJDK 21 using apt:
bash
sudo apt install openjdk-21-jre
If you encounter an error stating that the package can't be found, it means OpenJDK 21 isn't available in your repositories. In that case, proceed to the next method.
Alternative Methods to Install Java 21
Method 1: Download and Install from AdoptOpenJDK
AdoptOpenJDK (now known as Eclipse Adoptium) provides prebuilt OpenJDK binaries.