Solving Unsupported minor.major version error on Java

When we try to run Java code, which is compiled in higher compiler version, on a lower version environment, we get the Unsupported minor.major version error. We can resolve this issue is by installing latest java version on target system and run the program.

Another way is to use lower version of compiler and compile the code, before running the program. If we are getting Unsupported major.minor version 52.0 error, and our target environment is running on version 1.6, we may have to choose the same version, while compiling the code. Here, our code is compiled with version 1.8, which is higher than version 1.6

The version number 52.0 above shows the major releases of Java. Following are the list of major releases.

  • Java SE 10 = 54
  • Java SE 9 = 53
  • Java SE 8 = 52
  • Java SE 7 = 51
  • Java SE 6.0 = 50
  • Java SE 5.0 = 49
  • JDK 1.4 = 48
  • JDK 1.3 = 47
  • JDK 1.2 = 46
  • JDK 1.1 = 45


Solving the error using target command

We can use -target option while compiling the program using javac, to specify using which compiler version our code should be compiled. Following is the example of compiling code using JDK version 1.6.

javac -target 1.6

Solving the error on eclipse

While compiling Java code on eclipse, we can change the compiler version from project’s Java Compiler settings. Following are the steps to modify the compile version of the Java project on eclipse IDE.

  • Right click on project > Properties > Java Compiler as shown below.
  • Click on Enable Project Specific Setting option.
  • Uncheck option Use compliance from execution environment ‘JavaSE-X.X’ on the Java Build Path.
  • Select required Compiler Compliance level from Drop down option. Note that the available value depends on the installed Java version on your system.
  • Finally, click on Apply button and click on OK.


In the above example, we have changed compiler version used for the Java program to version 1.6.

Also read: