0

I am getting this error when compiling a project: Unsupported major.minor version 51.0. I am using JDK 1.6:

$ java -version
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)

According to this page, the error is due to inconsistency between JRE and JDK. Does anyone know how to fix this? Thank you very much.

BTW, my platform is OSX 10.8.5.

Update

Here is my JAVA_HOME:

export JAVA_HOME=`/usr/libexec/java_home -v 1.6.0`
Community
  • 1
  • 1
JBT
  • 8,498
  • 18
  • 65
  • 104

1 Answers1

2

You are getting "Unsupported major.minor version 51.0" because you are trying to run the application in jre 6 which is compiled using jdk 7.

Either compile your application using jdk 6 or upgrade your default jre to 7.

  • I realized that one of the dependency of the project was compiled in Java 7. After recompiling that dependency in Java 6, everything works like a charm. – JBT Sep 24 '13 at 19:17
  • @LeosLiterak: Yes, you were. – JBT Sep 25 '13 at 04:50