Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent java app name from appearing in menu bar and process dock on Mac

Tags:

java

macos

I'm starting a runnable jar from a java app ( also headless runnable jar). Tried both Runtime.getRuntime().exec() and ProcesBuilder method. The process gets launched just fine, but on the Mac ( 10.6 ) it shows the name of the jar I'm starting in the main menu bar and also puts in the dock Is there a way to prevent that ? Interestingly, if you start a jar with java -jar from the command line the jar name does not appear in the menu bar or process dock. Any ideas? Thanks Andy

like image 412
user2233677 Avatar asked Apr 01 '13 21:04

user2233677


People also ask

How do I remove an application from my Mac menu bar?

Remove Icons via the System PreferencesOpen the Apple menu and select System Preferences. Select Dock and Menu Bar. Select an item and uncheck the box next to Show in menu bar to remove it.

How do you customize the menu bar on a Mac?

On your Mac, use Dock & Menu Bar System Preferences to change the appearance of the Dock, and to select items to show in the menu bar and in Control Center. To change these preferences, choose Apple menu > System Preferences, then click Dock & Menu Bar .

How do I hide icons on Mac menu bar?

⌘ + drag to move the Hidden icons around in the menu bar. Click the Arrow icon to hide menu bar items.


1 Answers

To enable it globally instead of adding the option to each process, set the JAVA_TOOL_OPTIONS variable like this in your .bashrc/.zshrc start up script.

export JAVA_TOOL_OPTIONS='-Djava.awt.headless=true'

Reference here:

http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-VM/html/envvars.html

like image 96
arcot Avatar answered Oct 29 '22 18:10

arcot