Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert .jar to an OSX executable?

Tags:

java

I made a Java application which I would like to distribute on Windows, OSX and Linux without distributing a jar file. I used the great Windows exe wrapper http://launch4j.sourceforge.net/ to create an .exe file complete with my icon that won't scare Windows users.

Are there similar wrappers that I can use for OSX/Unix? An important consideration is that I would like to have my own icon on the executable (especially for mac users).

Thanks!

like image 241
Danny King Avatar asked Apr 22 '10 23:04

Danny King


People also ask

How do I make a jar file executable on a Mac?

jar is executable. Because Mac OS X ships with the Jar Launcher application, the end user needs only double click on the jar file and the application will launch. To make the jar file executable, the manifest must include the name of the Main class file.

Can you run a .jar on Mac?

Check If You Have Java On Your Mac.JAR files cannot run on any device that does not have Java pre-installed. The compatible platform required for this is either JRE or JDK. JRE stands for Java Runtime Environment, which is mandatory for creating Java virtual machines and executing programs written in Javascript.

How do I make a jar file executable?

Right click on your Java Project and select Export. Select Java -> Runnable JAR file -> Next. Select the Destination folder where you would like to save it and click Finish.

How do you open jar files on Mac?

3. How do I extract the contents of a JAR file on Mac? Simply right-click on your JAR file and select “Open With”. Then you just have to choose your preferred program from the drop-down menu, and extract.


1 Answers

Yes, on Mac OS X there is a program called Jar Bundler that is installed when you install the free (assuming that you already own a copy of Mac OS X) Xcode Developer Tools that allows you to bundle a JAR file inside a native Mac OS X "*.app" application bundle with a nice and shiny icon just like other apps.

Update
The JAR bundler doesn't exist on later versions of OS X. As a workaround, you can manually create an OS X project that invokes Java. Or, there are a variety of build system extensions that do a similar thing; for example, the gradle-macappbundle plugin for Gradle will create such a wrapper app.

like image 176
Michael Aaron Safyan Avatar answered Oct 13 '22 09:10

Michael Aaron Safyan