Menu

#112 "Bad version number in .class file" when starting GUI on OSX

closed
nobody
None
5
2010-11-02
2010-11-01
Anonymous
No

The following terminal transcript illustrates the problem:

[max@radon:~/Downloads/nxt_1.4.4]$ java -version
java version "1.5.0_26"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_26-b03-376-9M3263)
Java HotSpot(TM) Client VM (build 1.5.0_26-156, mixed mode)
[max@radon:~/Downloads/nxt_1.4.4]$ ./NXT-start-GUI.command
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:676)
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:317)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)

You can see that I have java 1.5.0_26 installed, which I believe is the most current version provided by Apple for OS X. The NXT readme file states that Java 1.4.2_05 should be sufficient to run the tools. Nonetheless, you can see that I am getting an UnsupportedClassVersionError exception, which I believe usually means that the class file was compiled with a newer java version than that of the VM trying to execute it. This occurs regardless of which java invocation I use in the .command file.

Discussion

  • Jonathan Kilgour

    Apologies - the target attribute for the javac compilation in my ant build file was not being correctly set. I have replaced the download named 1.4.4 with one where all the .class (and hence .jar) files are compatible with a 1.5 JVM. I have tested on a mac OSX machine with Java 1.5.0_26.

    Please try the download again.

     
  • Jonathan Kilgour

    • status: open --> pending
     
  • Anonymous

    Anonymous - 2010-11-02

    That seems to have fixed it. Thanks for the quick response!