Error compiling Scalatra project

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 C:\Program Files\Java\jdk1.6.0_43\bin.
  • Hmmm, then I ran the following command echo %JAVA_HOME% and it returned C:\Program Files\Java\jdk1.6.0_43.

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s