WebStorm (Mac) + Closure Compiler: Unsupported major.minor version 51.0

When trying to minify javascript file in WebStorm, using Closure Compiler, I was getting the following error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner : Unsupported major.minor version 51.0

It turns out my Mac was using an older version of java (1.6.x) which you can see by typing "java -version" in Terminal.

In case anyone else is having this problem, here's how I resolved it:

  1. Installed an updated (1.7.x) version of the Java SDK: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html ()
  2. Rebooted, and verified that "java -version" returned "1.7.x"
  3. Switched webstorm to use 1.7.x: https://intellij-support.jetbrains.com/entries/23455956-Selecting-the-JDK-version-the-IDE-will-run-under
  4. Restarted WebStorm
  5. Looks good!

There could possibly be some issues with WebStorm running with Java 1.7 (http://stackoverflow.com/questions/13019199/how-do-i-run-idea-intellij-on-mac-os-x-with-jdk-7/13019403#13019403). Will feedback here if I experience any problems.

Please sign in to leave a comment.