问题
I've created an app in java and I would like to be able to put it in the dock on Mac OS X. It's not possible to do it with the .jar file, so I've wrapped it in an .app folder. Now it won't even start.
The app creates files in the same directory as the MyApplication.jar file and I thought this might be the problem. Can you write files in the MyApplication.app directory? If not, what might be causing this problem?
回答1:
You may be missing the JavaApplicationStub
or some critical element in your Info.plist
. If these terms are unfamiliar, several related developer links are cited here. Technically, you can write to $JAVAROOT if you have permission, but the preferred approach is to use a directory available to the user, as discussed in the guidelines cited here.
回答2:
I finally did it using Eclipse. There's a export as a Mac bundle option in the file menu in the Mac OS X version of Eclipse :)
来源:https://stackoverflow.com/questions/17054293/put-a-java-app-in-the-dock-on-mac-os-x