How to create a .app folder from an executable .jar?

Just this. I have an executable jar that I'd like to create a .app folder for. Mainly just because I'd like it to be pinnable to the dock.

Is there any easy way to do this?

Edit: Really what I'm looking for, is a mac shortcut. But apparently on the .app folders can be pinned to a dock.


Solution 1:

If you want an easy way without need of third-party apps:

  1. Launch AppleScript editor
  2. Write the following:

    --do shell script "java -jar /Contents/execute.jar"

I commented that line out because we have yet to put the jar there. Save as application. Now Right click on produces .app file -> Show Package Contents, go to Contents and drag the .jar file there. Now go to Resources -> Scripts -> main.scpt and open that. Now remove the double dash (--), compile and save.

If it doesn't launch, try executing in terminal chmod 777 <path to jar file> simply drag the jar into Terminal.

Solution 2:

How about Platypus?! It can pack "all" kinds of things, jar, py, script etc download from http://sveinbjorn.org/platypus, its GUI is relatively easy to follow. enter image description here