Solution Advice: Mac ".app" folder

A simple example to make a Mac OS X application from generated binary file


A generated binary file of GUI application for Mac OS X can be launched directly, but it is not a kind of Mac OS X application. To be a Mac OS X application, we need to put it into an ".app" folder before we deploy it.


We just need to create an ".app" folder, and then put an "Info.plist" file in it and put the generated binary file into the 'MacOS' sub-folder, then modify the "Info.plist" to let it know the filename of the generated binary file. 

Features used

We advise you to use following features:

Feature Advice Introduction How to enable

GUI application


If your program is not GUI application, usually you need not to put it into an '.app' folder.

At Step 2, select Windows GUI

Splash window


To display a splash window is more friendly. This can tell user the program is starting.

At Step 3, select a picture

Force CWD


If your program need to run in a certain "working directory", you can enable "Force CWD" to ignore the start position.

At Step 6 > Config Internal > Custom tab, use a 'forcecwd' item

Stdout redirect


Because the console window is not visible, if you need to get the content of System.out, you can redirect it  to a disk file.

At Step 6 > Config Internal > Custom tab, use a 'stdout' item


Steps of this advice:

  1. The demo program is a simple calculator. ( Source code)
  2. Compile and pack into a jar file: SimpleCalc.jar. ( Jar file)
  3. Build a binary file for Mac OS X from jar file by Jar2Exe
    1. Start Jar2Exe, at step 1, click Browse Jar and select SimpleCalc.jar.
    2. Still at step 1, select Mac as target platform.
    3. At step 2, select Windows GUI application.
    4. At step 6, please check "Create Universal Binary", to create a binary with both 32 and 64 cores.
    5. Click next until finish, then get the binary file 'SimpleCalc' for Mac OS X.
    6. For other options, please refer to other solutions.
  4. Make a Mac OS X application from the binary file
    1. Make an empty folder, for example "./Calc/"
    2. Make a sub-folder 'Contents'.
    3. Make a sub-folder 'MacOS' and put the binary file in it, so we get "./Calc/Contents/MacOS/SimpleCalc".
    4. Add the 'execute' privilege to 'SimpleCalc' by 'chmod +x SimpleCalc' because windows filesystem could not express 'x'.
    5. Make a text file './Calc/Contents/Info.plist' with following content:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
      <plist version="1.0">
    6. Rename the folder "./Calc" to "./"
  5. Icon of Mac ".app" folder, the icon file of ".app" folder is a ".icns" file, which means "icons" in one file.
    1. Put the ".icns" file into sub-folder 'Resources', for example: "./Calc/Contents/Resources/SimpleCalc.icns".
    2. Specify the icon filename in 'Info.plist' file:



No such file or directory

My app read data from file txt in same folder with jar file. when I make app file on Mac and run it. It error :

./file_data/useragents.txt (No such file or directory)

How can I fix it.

Having troubles running Mac OS binary

Hello, I have been having troubles running the generated binary for Mac, this is after I turn on the execute flag with "chmod +x" an then run.

I have generated a Windows .exe with the same jar file that starts and performs as it should, but on Mac I get a java.lang.ExceptionInitializerError every time the program gets to the new FXMLLoader(url) part of my code. I have tried to look to at the URL by printing it out before loading and I noticed it had the format "j2e:com/xxxx/xxxx/xxxx.fxml" and I'm quite sure I have the "com/xxxx/xxxx/xxxx.fxml" resource file in the jar I provided.

The code below is how i am getting the fxml file in my code.

    URL url = getClass().getClassLoader().getResource("com/xxxx/xxxx/xxxx.fxml");

Where to put the jre directory on Mac ?

Hi, where to put the jre directory when bundle .app is used? inside MacOS directory?

thank you

you really need to update your doc pages on website to add Mac OS X information... ;)


executable won't run

Hi. When i try to generate a macos executable, the file doesn't appear as an executable when i copy it to my mac.

I opened up the .app file from your calculator example, and extracted the executable file from that, and am able to double click it outside the .app file to start it.

However, when i double click my own executable file, it opens up in a text editor. It doesn't appear to be recognized as an executable at all.

Any idea what i'm doing wrong? My executable is generated using jar2exe on my windows machine using the macos setting in the wizard. I've been able to get both linux and windows versions working just fine.

I found the solution...

I found the solution...

Open Terminal.

type...chmod +x

...with a space at the end (and do NOT press enter yet).

Then, drag the file you want to change from the Finder and drop it on top of the Terminal window. The file path and filename should automatically fill in (and you should ensure that there's a space between "+x" and the file path).

Press enter.

This changes the file to an executable.


I'm having the same problem.

I'm having the same problem. When I generate a MacOS file and copy it to the Mac the Mac thinks it's a text file. I also tried a Linux file and it also shows as a text file on the Mac.

Problem to Create App

I follow all steps but when I open the App I get a error message: The application “” can’t be opened.

I tried open the files on MacOS 10.10 and 10.11.2 and still doesn't work.

Any idea what could be?

Add new comment