Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can I change the title of my java app on the osx menubar?

Tags:

java

macos

I want to change the title of my java app on the osx menubar from the class name. I've tried putting this at the top of my main method but it does not work.

System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("apple.awt.application.name", "app name");
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Do I need a special library or something?

like image 658
user2992757 Avatar asked Oct 20 '25 00:10

user2992757


1 Answers

What you are doing looks correct, but you need to do it before any of your UI/window is created or AWT classes are loaded.

See this post: https://stackoverflow.com/a/33489386/1270000

Edit: note that behavior may be different when running your code in an IDE. So compile your code and test it rather than running directly from your IDE.

like image 143
sorifiend Avatar answered Oct 21 '25 12:10

sorifiend