Has anyone else noticed that command line java applications in OS X create GUI processes that steal focus (ie, groovy, maven sub processes)? I'm finding it extremely annoying; probably because I've been living with it for 6-8 months since I think OS X 10.6.

How can I prevent java processes from doing this in OS X?

  • 1
    This is a very good question, but I think it depends on the implementation of your Java app. If you ask those guys in Stack Overflow they might now which Java flag to turn on background mode when launching. Commented Feb 11, 2012 at 3:47
  • Yeah I asked there first, and never got any kind of response. When I do 'java -version' I see: Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11D50b) Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode...
    – dsummersl
    Commented Feb 11, 2012 at 17:21

1 Answer 1


Eventually I found the basic solution:

For Java applications in general you can specify that they are 'headless', by adding the option -Djava.awt.headless=true to your java application.

(also posted to stackoverflow).

  • Even with this flag my invisible Android simulator steal focus. Commented Apr 10, 2013 at 20:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .