How to deal with Unsupported major.minor version 55.0, 57,0, 60.0, 61.0 in Java + Eclipse + Linux [Solution]

The "unsupported major.minor version 55.0" error started to come after Java SE 11 release and the root cause of this error is trying to run a Java application compiled with JDK 11 into a JRE lower than Java SE 11 like JRE 9 or JRE 8. This is very common because a developer has updated their compiler or IDE to Java SE 11 but many times their runtime is not upgraded to Java 11. If you remember, in Java you can run a class file compiled with a lower version say Java 8 to a higher version say JRE 11 because Java is backward compatible but vice-versa is not allowed. I mean, you cannot run a JAR file or class file created by Java 11 version into  Java 8 or Java 9 version. Similarly, you cannot run a Java SE 17 compiled class file in Java SE 11 or Java SE 13 runtime environment.

This makes sense because every Java version has unique features. For example, Java SE 8 has features like lambda expressions, method reference, functional interface, and new Date and Time API, which lower version JRE has no information. Depending upon where you getting this error like Eclipse, NetBeans, IntelliJ IDEA, or Android Studio, the solution could be different. 

All these IDEs have different settings for JRE but the bottom line is the same, you need to configure these IDE to use JRE 8 to run the Java program compiled using Java 8.

The root causes of any java.lang.UnsupportedClassVersionError is always that you have compiled source file in higher JDK version and trying to run on lower JRE. The exact cause is printed on the version like in the case of major.minor version 55.0, you know that class file is compiled with JDK 11 because major version 55 corresponds to Java SE 11.

You might have seen the Unsupported major.minor version 52.0 error a couple of years back when JDK 8 was released because that came when a class file compiled using Java 8 was running on Java 6. The major version 52 corresponds to Java SE 8 release.




How to solve unsupported major.minor version 55.0 in Java

Now let's come back to the solution, how we are going to solve the major.minor version 55.0 error in Java? One of the reasons is incorrect JRE in the PATH environment variable.  If you are running the Java program from the command prompt then make sure the PATH has been set up correctly.

Just print the PATH using echo %PATH% in Windows 11 and echo $PATH in Linux to check if any lower version JRE is not coming up higher in the PATH than JRE 11. This is the main reason you get "unsupported major.minor version 55.0" even after you have installed Java 11 on your machine.

If you see JRE 8 or JRE 9 coming up higher or there is no JRE 11 at all then just install the JRE 11 and make sure it comes first in the PATH. Don't touch the classpath, this issue is not related to the classpath, it solely related to PATH and Java version used to compile and run the Java program.



Unsupported major.minor version 55.0 in Android Studio

Android Studio uses the value of JAVA_HOME to find the current Java version. Check the value of this environment variable and if it's not pointing to JDK 8 then make sure you correct the value of this environment variable. Don't forget to restart the Android studio if you unset JAVA_HOME while the android studio is running.

This should solve the problem of "unsupported major.minor version 55.0 error in Android Studio".  If you remember Android Studio is built from IntelliJ Idea, one of the popular Java IDE of both core Java and Java EE developers. See this article to learn more about the unsupported major minor version error in Java.

Unsupported major.minor version 52.0  in Java



Unsupported major.minor version 55.0 in Eclipse IDE

In Eclipse, the setting which is used to run a Java program is configured program by program basis. Just follow these steps to confirm that your program is running under JRE 11 and if not then make sure it does.

1) Go to "Run configurations" or "Debug configurations" (depending upon whether you are running or debugging Java programs)
2) Go to the JRE tab (the 3rd tab)
3) Check the value of Runtime JRE, if it's not Java SE 8 then choose the alternate JRE
4) If JDK 11 is not installed then Install Java 8 and add as JRE into Eclipse.
5) Follow steps 1 to 3 and then run the Java program.

This should solve the "unsupported major.minor version 55.0 error in Eclipse".  You can also check out Eclipse in Action: A Guide for the Java Developer to learn more about how to set up Java in Eclipse.


Unsupported major.minor version 52.0  in Java and Eclipse



Unsupported major.minor version 55.0 in IntelliJ IDEA

Depending upon which operating system you are running IntelliJ IDEA, your solution could be different. The bottom line is to make sure your IntelliJ IDE is using Java 8 for running your Java programs. For Mac OS X users you can do the following to instruct IntelliJ should use Java 8

1) Go to /Applications/IntelliJ IDEA 14.app/Contents/bin/ folder
2) Add gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.11.0_40.jdk/Contents/Home to idea.properties file.
You can find the idea.properties file in Mac OS X (10.9 - Mavericks) at in the above location (Applications/IntelliJ IDEA 14.app/Contents/bin/)
3) Restart IntelliJ IDEA.

IntelliJ IDEA uses Grade to compile and build your Java application.

How to fix Unsupported major.minor version 52.0 in Java IntelliJ Idea



Unsupported major.minor version 55.0 Linux

In order to solve this problem in Linux, make sure your Java application is using JDK 8 binary to run Java programs compiled on Java 8. If your application is using the JAVA_HOME environment variable to locate Java then make sure you set it correctly to point JDK 8 installation as shown below:

export JAVA_HOME=/usr/lib/jvm/java-8-oracle

Make sure JAVA_HOME is pointing to the correct JDK 8 installation directory.

Also, add JAVA_HOME on PATH as shown below:

export PATH = $PATH:$JAVA_HOME;

You can follow the same steps to fix an unsupported major.minor version 52.0 error in other UNIX-based operating systems like Ubuntu, Solaris, or IBM AIX.


That's all about how to solve unsupported major.minor version 55.0 error in Java. The root cause of the error is that your Java program is compiled using Javac11 but the JRE running this program is of a lower version like JRE 8 or JRE 9. Just use the latest JRE , I mean JRE 11 or Java 17 to run this Java program. Mostly you need to check the PATH environment variable that JRE 11 is included and it's the first one in the search path. 


Other Java troubleshooting guides for Programmers
  • General Guide to solve java.lang.ClassNotFoundException in Java [guide]
  • How to solve java.lang.ClassNotFoundException:org.Springframework.Web.Context.ContextLoaderListener [solution]
  • How to connect to MySQL database from Java Program [steps]
  • How to solve java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in Java MySQL? [solution]
  • java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory? [solution]
  • How to solve java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver in Java? [solution]
  • How to fix java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver in Java? [solution]
  • How to fix java.lang.ClassNotFoundException: org.postgresql.Driver error in Java? [solution]
  • How to avoid ConcurrentModificationException in Java? (solution)
  • Exception in thread "main" java.lang.IllegalStateException during Iterator.remove() (fix)
  • java.sql.SQLException: No suitable driver found for jdbc:jtds:sqlserver (solution)
  • Cause and solution of java.lang.ClassNotFoundException: com.mysql.jdbc.Driver (solution)

P. S. - Depending upon which OS you are running e.g. Windows 10, Linux, or MAC OS X, you need to follow the respective approach to set the PATH correctly.

2 comments:

Feel free to comment, ask questions if you have any doubt.