title: Bundle a Java 7 .jar for Mac
body: <p>I created a .jar that requires Java 7. I have Java 7 (JDK and JRE) and I can double-click to run the .jar. However, I want to package this into an application.</p>
  
  <p>What I tried: Using Apple's Jar Bundler tool, I successfully created an application; however, when I run it, it quickly appears and disappears in the dock. When I run the internal file <code>JavaApplicationStub</code> from Terminal, I get:</p>
  
  <pre><code>Exception in thread "main" java.lang.UnsupportedClassVersionError: org/lcmmun/kiosk/gui/Kiosk : Unsupported major.minor version 51.0
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
      at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at apple.launcher.LaunchRunner.loadMainMethod(LaunchRunner.java:56)
      at apple.launcher.LaunchRunner.run(LaunchRunner.java:112)
      at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:51)
      at apple.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.java:52)
  </code></pre>
  
  <p>which, according to "<a href="https://stackoverflow.com/questions/8982730/unsupportedclassversionerror-unsupported-major-minor-version-51-0-unable-to-load">unsupportedclassversionerror unsupported major.minor version 51.0 unable to load class</a>" means that I don't have Java 7 installed. But I do.</p>
  
  <p>So my hypothesis is that <code>JavaApplicationStub</code> is Java 7-incompatible.</p>
  
  <p>I've also heard of <a href="http://jarbundler.sourceforge.net/" rel="nofollow noreferrer">an ANT task</a> to accomplish the same task, but it seemed too complicated, and I don't know how to use ANT. If this really is the solution, though, I'd be happy to learn.</p>
  
  <p><strong>EDIT</strong>: I have now also tried Eclipse's <em>Export > Other > Mac OS Application Bundle</em>. This fails as well.</p>
  
  <p>I'm running 10.8 Mountain Lion, 64-bit.</p>