Question

I've got a problem on an older Mac with OS X 10.5.8 "Leopard".

Loading a specific java class is failing with Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file and I know that this normaly states that the java classes are compiled for a higher JVM than the one currently installed.

However, I compiled the classes for Java 6 using JDK 6 and the Mac got Java 6 installed!

This is what java -version says on the Mac:

bih37-4:~ bih37$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-9M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)

And this is how i compiled the java classes with ant 1.7 on a windows system with JDK 1.6.0_43:

<target name="compile" depends="clean">
    <javac srcdir="src" destdir="bin" target="1.6" encoding="utf-8">
        <classpath refid="classpath.base" />
    </javac>
</target>

AFAIK everything should run very smooth, and so it does on Windows 7 and on OS X Mavericks but NOT on OS X 10.5 "Leopard".

To be sure I don't forget something: This is a screenshot of the Java settings on the "Leopard" system: enter image description here

Any ideas?

Was it helpful?

Solution

Was all my fault. Thanks to Dirks question reg. the startup process I double-checked the bash launcher script which my colleague wrote and saw that he starts java with /Library/Java/Home/bin/java -jar ... instead of using only java -jar ....

While java points to the Java 6 JDK, /Library/Java/Home/bin/java still points to old Java 5. Bummer! :-(

With using java -jar ... instead in the bash script, everything works fine now...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top