osx - How to run java application with built-in command line arguments? -
I am creating a Java application that is stored in a .jar file and can be launched by opening the jar file By clicking on the command line or icon
For the Mac version of the app, I would like to show the menu bar at the top of the screen in Mac style instead of the window (Windows Style). I know that it can be done with the command line:
java -jar app.jar -Dcom.apple.macos.useScreenMenuBar = true
But this will not work if the user does not know how to do this command line argument is created in jar file?
You can do this by setting system properties in your code in the main method or in some other method, Which is called at the beginning of the application:
System.setProperty ("com.apple.macos. UseScreenMenuBar", "true")
Comments
Post a Comment