How to change the Java application name shown in the Mac OS X launchpad

前端 未结 4 1982
予麋鹿
予麋鹿 2021-02-20 07:33

When my application written in Java with SWT runs under OS X, both from under Eclipse and from jar, its name in

相关标签:
4条回答
  • 2021-02-20 07:44

    @m. vokhm I hope you have tried the following link

    http://www.eclipse.org/articles/Article-Branding/branding-your-application.html

    Also Check "3. How a launch can be triggered" in the link below

    http://www.vogella.com/tutorials/EclipseLauncherFramework/article.html

    0 讨论(0)
  • 2021-02-20 07:51

    You should create a macOS app bundle with your jar, where you can put the bundle display name in the Info.plist file of the bundle.This is well documented by Oracle (http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html).

    The structure of a Java app bundle is documented by Apple as well: https://developer.apple.com/library/content/documentation/Java/Conceptual/Java14Development/03-JavaDeployment/JavaDeployment.html

    0 讨论(0)
  • 2021-02-20 07:54

    The only answer that worked for me is here. In short:

    Using JDK8, you can set the apple.awt.application.name property to affect the Application menu name.

    However, Martijn Courteaux’s warning that you must do this before any AWT classes are loaded still applies. And AWT classes will be loaded before your main() method runs if it lives in a subclass of JFrame.

    In other words, set apple.awt.application.name and do it before creating the JFrame.

    P.S. If you're trying to change the dock application title, this command might work:

    java -Xdock:name=Alfabet

    0 讨论(0)
  • 2021-02-20 08:00

    You should do the following during app initialization, before GUI is built:

    // take the menu bar off the jframe
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    
    // set the name of the application menu item
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "AppName");
    
    // set the look and feel
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    

    But above code works in Java 1.5, this code may not work in 1.6

    For new java see documentation:

    1. Either use -Xdock:name command-line property:-Xdock:name=YourAppName
    2. Or set CFBundleName in information property list file (plist)
    0 讨论(0)
提交回复
热议问题