I have created an executable java Swing .jar application. It works fine on Windows. The application hierarchy is :
application.jar
images(Folder) ………. Contains all images the application uses.
libraries(Folder) ……. Contains all external jar libraries the application uses.
bundles(Folder) ……… Contains all bundle files the application uses.
database(Folder) …….. Contains the database files the application uses.
All the above folders exist outside the jar file. Now i am trying to create a Mac executable file (.app) from "application.jar" to run it on Mac so i used the "Jar Bundler" as specified here but when i run the output application.app file nothing happens, nothing runs and i can’t even debug it.
I think the main reason is that it can’t see the external folders. So is it impossible to create a .app file if the application has external folders ?
And is there a way to debug the .app file to see what’s going on ?
Most likely the problem is your working directory.
When you run an executable JAR file by double-clicking it, the working directory is the parent directory of the JAR file.
By default, the working directory of an application bundle is its parent directory. If you package the external folders into the application bundle they will be located under
$APP_PACKAGE/Contents/Resources.So the assumption about the working directory that you make for an executable JAR file does not hold for an application bundle.
In order to set the working directory to the resources directory, add
to the
Info.plistfile of your bundle.In case you know nothing about application bundles, please read this document.