dcodeIO/ClosureCompiler.js

Exception in thread "main" java.lang.UnsupportedClassVersionError

Closed this issue · 7 comments

Hi,

I would like to try this package. Unfortunately I get the following error, when I run the example code or the command line tool.
Can anyone help?

ccjs lib/File.js
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: com.google.javascript.jscomp.CommandLineRunner. Program will exit.

This looks like a bug in closure compiler itself or some sort of corrupted .jar to me. Have you tried to reinstall the package entirely?

I have tried it with a local and a global installation of the package. Both do not work. We use the compiler on another project. Can this cause a conflict?
How do I get an non-corrupted version of the compiler? Can I just download it from the official page and replace it? Or are there any neccessary changes in the compiler from this project?

Yes, you can download it from the official page and put the compiler.jar into the ./compiler directory. Let me know if this works.

http://dl.google.com/closure-compiler/compiler-latest.zip

Unfortunately this did not work. But I tried an older compiler.jar which I use on another project and it works. Perhaps it's because of my Java version.

java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.5) (suse-36.2-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

java -jar compiler.old.jar --version
Closure Compiler (http://code.google.com/closure/compiler)
Version: exported
Built on: 2013/02/28 16:05

java -jar compiler.original.jar --version
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: com.google.javascript.jscomp.CommandLineRunner. Program will exit.

Should the compiler complain about wrong type annotations? Or how can I enable this feature?

Have you tried to install the official sun / openjdk 7 runtime instead?

No, I haven't. I have only tried to run it with openSuse's java-package. Previous version did work with that package. Seems like it's not working anymore with the current version. Will try it later.