title: Convert Java to .app file for MacOSX using JarBundler
body: <p>All I'm trying to do is convert a simple java program into a macOSX .app file so I can distribute it as a simple executable file.</p>
  
  <p>I've read all over the place and everyone says the same things:</p>
  
  <ol>
  <li>Use Xcode - As far as I can tell, Xcode no longer supports Java Builds</li>
  <li><p>Use Jar Bundler - All the tutorials seem to be out of date, and it doesn't work. When I run:
  java -jar jarbundler-2.0.0.jar</p>
  
  <p>The console returns "no main manifest attribute in jarbundler-2.0.0.jar"</p>
  
  <p>If I'm right, this would be a fail on whoever packaged the jar file right? But I've tried downloading it from other websites and other versions, but I get the same thing.</p></li>
  <li><p>They say you can just create the directories and files yourself and then rename your folder to .app and then run a command on it or something but this is complicated since I don't know exactly how to create an info.plist file...if you want to do it this way, the best website I've found so far is this one: <a href="http://developer.apple.com/library/mac/#documentation/Java/Conceptual/Java14Development/03-JavaDeployment/JavaDeployment.html" rel="nofollow">Java Deployment Options for OSX</a></p></li>
  </ol>
  
  <p>I've compiled my code into a .jar file, I have an icon and everything, all I need to do is package it somehow into a .app file.</p>
  
  <p>Thanks for the help in advance!</p>
  
  <h1>Solution</h1>
  
  <p>EDIT:  I got it! After 7 or 8 hours of searching and reading it works. Since I'm new to this, I'm going to post everything I learned to save others that run into the same problem from going through the pain. I gave up on the do it yourself method and went back to JarBundler. If anyone else is reading this and they don't know anything about ANT, here's what I did: Download JarBundler, I got mine from here: <a href="http://informagen.com/JarBundler/" rel="nofollow">Mac OS X JarBundler ANT Task</a> and follow the instructions there.</p>
  
  <p>When you download it, put the jarbundler-2.2.0.jar file here:</p>
  
  <p>/usr/share/ant/lib</p>
  
  <p>you might have to run a command to move it, something like:</p>
  
  <p>sudo mv jarbundler-2.2.0.jar ~/../../usr/share/ant/lib/jarbundler-2.2.0.jar</p>
  
  <p>like I said, I'm still learning, but this worked for me.</p>
  
  <p>Make sure you moved the right jarbundler, this is where I ran into problems, I moved the entire folder, rather than the inner .jar file, so make sure you move the .jar that's inside the folder zip you downloaded, not the whole thing, otherwise when you go to build it, you'll get an error saying something like error: taskdef class net.sourceforge.jarbundler.JarBundler could not be found.</p>
  
  <p>Then you need to compile your code into a .jar file (there are two types, one is like a .zip and the other is an executable) You want a normal JAR file, NOT executable, so to do that you first need to compile your code to get .class files, then open a command prompt and follow the instructions here: <a href="http://docs.oracle.com/javase/tutorial/deployment/jar/build.html" rel="nofollow">Create a Jar File</a> The command will look something like this:</p>
  
  <p>jar cf myName.jar *.class</p>
  
  <p>Once you have your jar file, you need to create a .xml file in the same folder and needs to be called build.xml. Edit it with a text editor. Follow the instructions on the link above to create it. It will look something like this:</p>
  
  <pre><code>//build.xml
  
  &lt;project name="MyProject"&gt;
  
  &lt;taskdef name="jarbundler"
  classname="net.sourceforge.jarbundler.JarBundler" /&gt;
  
  &lt;target name="bundle"&gt;
  
  &lt;jarbundler dir="release"
          name="Apollo's Image Editor"
          mainclass="ImageEditorGUI" 
          jar="ApolloIE.jar"
          icon="Aperture.icns" /&gt;
  
  &lt;/target&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>From there (I'm using a Macbook Pro by the way) all you have to do is run a command line from that folder:</p>
  
  <p>ant bundle</p>
  
  <p>and it should create a .app file in a folder called release. So to summarize:
  all you need is your .jar file and build.xml file in the same folder, and then run the command:
  ant bundle (or whatever you named your target in the build.xml file, I named it bundle)</p>
  
  <p>Good luck, hope this helps anyone out there.</p>
  
  <p>If anyone is wondering, I took the Info.plist that was generated by the JarBundler and put it into the directory I was making and it worked! So that was the problem, I just didn't know how to format it right... here it is: <a href="http://i.stack.imgur.com/KWDoh.png" rel="nofollow">Info.plist</a></p>