7

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.

4 Answers 4

5

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.

10
  • Someone please dit my question. do shell script didn't want to go to code blocks after quadruple space
    – John K
    Jun 15, 2015 at 10:41
  • Question: how do I do this from the terminal?
    – thouliha
    Jun 15, 2015 at 12:39
  • You launch the jar from terminal by writing java -jar /path/to/jar.jar. However this answer covers launching it as an app. Basically, making a script that executes shell that launches jar inside the app bundle.
    – John K
    Jun 15, 2015 at 12:43
  • No I mean, how do I run this applescript from the terminal?
    – thouliha
    Jun 15, 2015 at 12:46
  • 1
    Keep in mind that you need the Java JDK installed for this to work. I tried to run it in the command line and was prompted to install it.
    – Hendeca
    Jul 23, 2019 at 15:33
3

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

1
  • 1
    Welcome to Ask Different! We're trying to find the best answers and those answers will provide info as to why they're the best. Explain why you think the answer you provided will solve the problem or is better than others out there. Providing links can also help the OP, and others, find additional info for themselves. See How to Answer on how to provide a quality answer. - From Review
    – fsb
    Dec 29, 2016 at 21:35
0

Do you have access to the source? If so, you can try the appbundler.

https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html

Or the Jar Bundler: https://developer.apple.com/library/mac/documentation/Java/Conceptual/Java14Development/03-JavaDeployment/JavaDeployment.html

2
  • Thejar bundler was for Java 6 and earlier and is not,available now
    – mmmmmm
    Jun 15, 2015 at 9:00
  • Yep, this is unusable for me.
    – thouliha
    Jun 15, 2015 at 12:56
0

Take a look at Packr. I think it does exactly what you need https://github.com/libgdx/packr.

1
  • Note this also adds the ire to the bundle - which might or might not be wanted
    – mmmmmm
    Jun 15, 2015 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .