Menu

Bad version number in .class file - Mac OSX

2009-07-29
2013-04-16
  • bettison.org

    bettison.org - 2009-07-29

    I also have an issue I came across whilst trying to chase down my "Tech Level issues".

    Unfortunately I have never ever done any Java Programming, so I can't tell if its something really trivial or obvious that I am overlooking.

    I was trying to test the latest src from svn to see if it helped with my Tech Level problems,

    I checked out the code, and managed to figure out how to set up a build environment. I built the latest code which ran OK. (I also managed to change the code and rebuild it, it to test that I was in running the 'built' copy)

    However when I run it on Mac OS 10.5.6 I get this error...

    $ java -jar jvc.jarException 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)

    Worked fine on Linux

    If anyone could give me any pointers as to where I need to look, or what is causing the error I am more than happy to try and fix it myself. It would be just the motiviation I need to learn a bit a of Java!

    Thanks

    linux $ java -version
    java version "1.6.0_12"
    Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
    Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode)

    mac $ java -version
    java version "1.5.0_19"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-304)
    Java HotSpot(TM) Client VM (build 1.5.0_19-137, mixed mode, sharing)

     
    • bettison.org

      bettison.org - 2009-07-29

      Just a quick note - I found out that in 'Java Preferences' I have several Java VM's installed and if I change the preferred order to put Java 6 first then it appears to work OK.

      mac $ java -version
      java version "1.6.0_13"
      Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)
      Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)

      So I gues its just an issue with older versions of Java.

       

Log in to post a comment.