Not working on Mac OS X Leopard

274 views
Skip to first unread message

Troex Nevelin

unread,
Nov 7, 2009, 11:43:58 AM11/7/09
to Closure Compiler Discuss
As I know OSX comes with sun java.

$ java
~/Downloads/compiler-latest $ java -jar compiler.jar --help
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad
version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)

Maybe I'm missing something?

bolinfest

unread,
Nov 7, 2009, 11:48:18 AM11/7/09
to Closure Compiler Discuss
Maybe the jar was compiled with java 1.6 and you're using java 1.5?
Running "java -version" in Terminal should tell you.

You can either upgrade your Java or build the jar yourself. Building
the jar is pretty easy -- just check out the code from subversion and
from the directory run "ant jar". The jar will end up in build/
compiler.jar.

Troex Nevelin

unread,
Nov 7, 2009, 3:28:31 PM11/7/09
to Closure Compiler Discuss
trying to compile I get:
$ ant jar
Buildfile: build.xml

compile:
[mkdir] Created dir: /Users/troex/Downloads/src/closure-compiler-
read-only/build/classes
[javac] Compiling 298 source files to /Users/troex/Downloads/src/
closure-compiler-read-only/build/classes
[javac] /Users/troex/Downloads/src/closure-compiler-read-only/src/
com/google/javascript/jscomp/AbstractCompiler.java:19: cannot access
com.google.common.base.Supplier
[javac] bad class file: /Users/troex/Downloads/src/closure-
compiler-read-only/lib/google_common_deploy.jar(com/google/common/base/
Supplier.class)
[javac] class file has wrong version 50.0, should be 49.0
[javac] Please remove or make sure it appears in the correct
subdirectory of the classpath.
[javac] import com.google.common.base.Supplier;
[javac] ^
[javac] 1 error

BUILD FAILED
/Users/troex/Downloads/src/closure-compiler-read-only/build.xml:50:
Compile failed; see the compiler error output for details.

Total time: 4 seconds


Do I need to get other sources?

$ java -version
java version "1.5.0_20"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-
b02-315)
Java HotSpot(TM) Client VM (build 1.5.0_20-141, mixed mode, sharing)

Nick Santos

unread,
Nov 7, 2009, 3:37:25 PM11/7/09
to closure-comp...@googlegroups.com
The source uses Java 1.6-only features. So you really do need the newer version.

Nick

Daniel James

unread,
Nov 7, 2009, 4:44:58 PM11/7/09
to closure-comp...@googlegroups.com
On Sat, Nov 7, 2009 at 8:28 PM, Troex Nevelin <li...@mrtech.ru> wrote:
>
> $ java -version
> java version "1.5.0_20"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-
> b02-315)
> Java HotSpot(TM) Client VM (build 1.5.0_20-141, mixed mode, sharing)

I think the version of Java 1.6 distributed by Apple only works for a
64-bit intel macs but isn't used by default. You can change the
version that you're using in 'Java Preferences' which should be in
your /Application/Utilities directory. If you've got a 32-bit intel
processor, you might be able to use the SoyLatte Java 6 port (link
below). If you're on a PowerPC machine, it looks like you're out of
luck.

http://landonf.bikemonkey.org/static/soylatte/

Daniel

Troex Nevelin

unread,
Nov 7, 2009, 4:56:16 PM11/7/09
to Closure Compiler Discuss
Thanks for the reply, but I'm on early MacBook machine and it isn't 64-
bit compatible, so I can't switch to 1.6. Anyway I just apt-geted java
to my debian box and run compiler without problem.

On Nov 8, 12:44 am, Daniel James <daniel_ja...@fmail.co.uk> wrote:

Peter Burns

unread,
Nov 7, 2009, 8:51:07 PM11/7/09
to Closure Compiler Discuss
The latest version of Java that Apple ships for Leopard is 1.5. Snow
Leopard comes with Java 1.6, and I can confirm it runs Closure
Compiler.

Daniel James

unread,
Nov 8, 2009, 5:20:03 AM11/8/09
to closure-comp...@googlegroups.com
On Sun, Nov 8, 2009 at 1:51 AM, Peter Burns <ric...@gmail.com> wrote:
>
> The latest version of Java that Apple ships for Leopard is 1.5.  Snow
> Leopard comes with Java 1.6, and I can confirm it runs Closure
> Compiler.

Apple ships Java 1.6 for Leopard on 64-bit intel macs. Although you
have to use Java Preference to select it first.

Daniel

Reply all
Reply to author
Forward
0 new messages