Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sknight126

macrumors newbie
Original poster
Oct 16, 2007
3
0
I have come accross the error,

java -jar comirva-0.10d.jar
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:620)
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

I believe this is because I didn't have Java 6 on my mac. I have now managed to get a beta version of Java 6 however the same problem occurs. When I identify the version I get this,
java -version
java version "1.5.0_07"
How do I get the jar file to run in Java 6?
Thanks
 

garethlewis2

macrumors 6502
Dec 6, 2006
277
1
You should have it installed in the following place

/System/Library/Frameworks/JavaVM.framework/Versions

In there you will see a series of directories, e.g.

1.3.1
1.4.2
1.5.0
1.6.0 or 6.0

Then there will be a symbolic link called CurrentJDK which references currently 1.5.0.

You need to change that link to 1.6.0 or 6.0 or whatever you have. Then you will have Java 6 running as the default. You must be sure to understand the reason, this is not installed as the default is it is as stable as Windows ME.
 

sknight126

macrumors newbie
Original poster
Oct 16, 2007
3
0
I deleted the old Current JDK and then used:

sudo ln -s -f /System/Library/Frameworks/JavaVM.framework/Versions/1.6 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK

and I get:

ls -l /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK

lrwxr-xr-x 1 root wheel 56 Oct 16 10:47 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK -> /System/Library/Frameworks/JavaVM.framework/Versions/1.6

However when I type

java -version I still get:

java version "1.5.0_07"

and so the same error message is occuring.
 

garethlewis2

macrumors 6502
Dec 6, 2006
277
1
Two things.

Did you restart terminal after you made the change?

If not type the command hash -r to recreate the hash table. Then type java -version again

If this doesn't work do the following.

check what /usr/bin/java is referenced to.

It should be set to the
/System/Library/JavaVM.framework/Versions/CurrentJDK/Commands/java

Then you run the command

ls -ltr /System/Library/JavaVM.framework/Version/CurrentJDK/

It should respond with 1.6.0 or whatever you have.

If this doesn't your symbolic link was created incorrectly.
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
Where did you get Java 6 for OS X? I don't see it listed in the ADC or on Sun's downloads page for Java.
 

jstad

macrumors regular
Jun 13, 2007
119
0
Where did you get Java 6 for OS X? I don't see it listed in the ADC or on Sun's downloads page for Java.

He is compiling from source. Which is possible just some people feel pointless since now the Java Bridge has been sniped out by Apple for Leopard.
 

sknight126

macrumors newbie
Original poster
Oct 16, 2007
3
0
Firstly

Yes I reset the terminal.

My /usr/bin/java is referrence to:

/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

Does this need to be changed to CurrentJDK?

Secondly
There is a beta version for Java 6 but it was pulled from the apple developers website a while back. I managed to download it after lots of googling.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.