Swing application menu name not displaying correctly in Java 1.8

扶醉桌前 提交于 2019-12-01 06:35:21
trashgod

Using Java 8 on Mac OS X 10.9, setting the System property

System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Name");

appears to be ineffectual in changing the name displayed in the application menu. Alternatives that still work include these:

  • By default, the application menu will display the simple name of the class specified in the java command line or the Main-Class attribute of the JAR's manifest.

     java -cp build/classes mypackage.Name
     java -jar dist/MyJar.jar
    
  • Use the -Xdock:name="Name" command line parameter.

    java -Xdock:name="Name" -cp build/classes mypackage.Main
    java -Xdock:name="Name" -jar MyJar.jar
    
  • Add the application JAR to a Mac application bundle, as shown here, an add the attribute to the Info.plist.

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