Seriously? Unsupported major.minor version 51.0 when compiling a Scalatra project? The complete error is “Caused by: java.lang.UnsupportedClassVersionError: org/eclipse/jetty/server/Handler : Unsupported major.minor version 51.0”. After some Googling I found the following statement “You are using different JDK versions to compile and run the application”. No way, that is not possible.
I ran the following commands from the command prompt:
> java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) > javac -version javac 1.6.0_43
No way! Way! How the hell is this possible?
- From the command prompt I ran the command
echo %path%. In the output I looked for the JDK. It was pointing to
- Hmmm, then I ran the following command
echo %JAVA_HOME%and it returned
Seriously? Where is the version 1.7 coming from. Grrrr, after some Googling I found out that java.exe, javaw.exe and javaws.exe are also located under
c:\Windows\System32. Why? Anyway, I renamed these files by adding “.IGNORE” to the file name. After that I fired up sbt again and the Scalatra project compiled without any problem. O yeah. Nice.