Tutorial :JAR file not opening on a Mac


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)  


I'm guessing that the JAR requires Java 6; most Macs only have Java 5 installed.


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!


UnsupportedClassVersionError - there's your culprit. The class file was generated on a later version of the JDK than the JRE you're trying to run it on.


Currently Macs ship with have Java 1.5. Java 1.6 can be downloaded for 64 bit Intel Macs here: http://support.apple.com/downloads/Java_for_Mac_OS_X_10_5_Update_1. From http://support.apple.com/kb/HT1856:

This release does not change the default version of Java. This release is only for Mac OS X 10.5.2 and later, and should not be installed on earlier versions of Mac OS X. This release is for 64-bit, Intel-based Macs only and cannot run on PowerPC-based or 32-bit Intel-based Macs.


Just right click the .jar file and open with archive utility. Simple. Location of archive utility: /System/Library/CoreServices/Archive\ Utility.app

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »