user2233677
user2233677

Reputation: 199

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

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

Upvotes: 16

Views: 3059

Answers (2)

arcot
arcot

Reputation: 390

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

Upvotes: 32

martinez314
martinez314

Reputation: 12332

Are you passing java.awt.headless=true? Try adding this to your process:

java -Djava.awt.headless=true

Upvotes: 11

Related Questions