Reputation: 709
I tried to create my first OSX app bundle for a Java application today. It works, but there is one problem and I could not find any solution for it.
The Java application is a web server without user interface. What happens when I start the app bundle, is the following:
The main purpose of this app bundle is to provide a demo application to people who are interested in trying the server out - easily without any setup, etc.
The application should remain in the Dock and users should be able to close (stop) the server in the Dock.
I imagine that this might be configurable in Info.plist somehow, but don't have any experience with it. Or probably there is something else I can do in order to achieve the desired behavior?
Thanks for any ideas or hints.
Upvotes: 4
Views: 249
Reputation: 709
I found the answer to this problem today:
I didn't notice it when copying configuration details into Apple's Jar Bundler, but I had this in the VMOptions parameter (Info.plist file):
<key>Java</key>
<dict>
[...]
<key>VMOptions</key>
<string>-Djava.awt.headless=true</string>
[...]
</dict>
Passing -Djava.awt.headless=true
to the Java VM was the problem. After removing this parameter, the application behaved just as I wanted. It doesn't have a window but a simple menu with quit option is there, so users can easily stop the application.
Upvotes: 1