How can i create executable apple .app file from my java .jar file?

本小妞迷上赌 提交于 2019-12-04 18:42:41

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

<key>WorkingDirectory</key>
<string>$APP_PACKAGE/Contents/Resources</string>

to the Info.plist file of your bundle.

In case you know nothing about application bundles, please read this document.

Nothing runs, and i can't even debug it.

Diagnostic output from the launch process may be obtained as follows:

$ export JAVA_LAUNCHER_VERBOSE
$ ./YourApplication.app/Contents/MacOS/JavaApplicationStub

There's a related example here.

This might help: AppBundler by Josh Marinacci

I am not sure about your exact directory hierarchy. But on a Mac with Xcode installed is an application called "Jar Bundler". It exist for exact that purpose you are asking for. BTW, Mac application use the suffix .app, that is right. But they are not files. Thery are directories.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!