Exception in thread “main” java.lang.UnsupportedClassVersionError: net/minecraft/server/MinecraftServer : Unsupported major.minor version 52.0

The Problem

  • Minecraft Version: 1.12.2
  • Operating System: MintLinux
  • Linux Version: 17.04

On downloading and launching the new Minecraft launcher version 1.12.2, an error occurs when starting the game. The error says:

Exception in thread “main” java.lang.UnsupportedClassVersionError: net/minecraft/server/MinecraftServer : Unsupported major.minor version 52.0

The reason for this error is that as of version 1.12.2 Minecraft have started to compile the game using JDK Version 8. Unfortunately the JDK inside most Ubuntu based Linux  systems is version 7.

The Solution:

You will need to install a version 8 JDK / JRE. As of the date of writing I haven’t seen an open JDK version 8 that works with Ubuntu 17.04 so used the Oracle JDK.

Instructions given below are all to be typed in a terminal session. It’s easier than trying to guess your way through screens and mouse clicks.

1. Open terminal (Ctrl+Alt+T or via your menu) and run the command:

sudo add-apt-repository ppa:webupd8team/java

2. Update your cache

sudo apt update

3. Install the Java 8

sudo apt install oracle-java8-installer

4. At some point a window will pop up asking you to agree to Oracles terms and conditions. Select OK / YES

screen showing Java Terms And Conditions to accept license
Accept Java License

5. You now need to set Java 8 as default – or play with variables in Minecraft that I’m not going to cover here.

sudo apt install oracle-java8-set-default

6. Check which java version you are now running. Hopefully it will say 1.8.nnnn as the current version

javac -version

7. Start Minecraft – Enjoy.

As a side note – Java version 9 is out – but Oracle is suggesting it is not yet stable enough to use. However when the time comes these instructions will let you install java 9 just by changing the number 8 in the instructions above to 9.