I am making a Java application that is stored in a .jar file and can be launched by opening the jar file either from the command line or from clicking the icon.
For the Mac version of the app, I would like the menu bars to appear at the top of screen in the Mac style instead of in the window (the Windows style). I know this can be done with the command line:
java -jar App.jar -Dcom.apple.macos.useScreenMenuBar=true
But this won’t work if the user doesn’t know how to do this. Is there a way to make this command line argument “built in” to the jar file?
You can do this by setting the system property in your code in the main method or some other method which is called at the very beginning of the application: