Java – JAR file not opening on a Mac

classjarjavamacos

I have been trying to open a JAR file on my Mac with no success. It says the JAR file could not be opened and asks me to look for any error messages in my console. Here are the console messages. I suspect the prob is in the first line itself, but I am not from a software background, so don't know if this is enough for anyone who knows Java to tell what the issue is. I did update my software, so I am assuming I have the latest version of Java although I don't know how to 100% ensure that – the Java.com website just told me to update the overall software on my Mac and said that will take care of Java's latest version also. Please help!

5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079] Exception in thread "main"  
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079] java.lang.UnsupportedClassVersionError: Bad version number in .class file 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.lang.ClassLoader.defineClass1(Native Method) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.lang.ClassLoader.defineClass(ClassLoader.java:675) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.net.URLClassLoader.access$100(URLClassLoader.java:56) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.net.URLClassLoader$1.run(URLClassLoader.java:195) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.security.AccessController.doPrivileged(Native Method) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.net.URLClassLoader.findClass(URLClassLoader.java:188) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.lang.ClassLoader.loadClass(ClassLoader.java:316) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.lang.ClassLoader.loadClass(ClassLoader.java:251) 
5/26/09 7:48:01 AM [0x0-0x72072].com.apple.JarLauncher[1079]  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)

Best Answer

The above exception is thrown when a JVM encounters an unsupported class version. This occurs when the JVM encounters a class built for a later JVM. So you need to upgrade your VM, then change your default Java.

Here's how to change your default:

Type 'java preferences' into Spotlight. You'll see the 'Java Preferences' utility. Run that, and you can change the default Java instance to what you require (probably Java 6).

EDIT: That utility is in Application/Utilities/Java. Using Spotlight seems an easier way to find it though!

Related Topic