Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running `play test` on OSX causes a java app to appear in the dock

This wouldn't be a major issue, but the app is stealing focus every time it goes off.

The app icon that appears in the dock is named sbt.ForkMain.

I've traced it down to ebean.default="models.*" in the application.conf file. When this line is commented out, the app dosen't run. I'm quite sure this has something to do with the ebean server starting up, but it dosen't happen on any of my other machines.

I'm using a brand new installation of OSX 10.8.3, and this happens even in a clean play new xxxx folder.

play! 2.1.0 (using Java 1.6.0_51 and Scala 2.10.0), http://www.playframework.org

Any help would be appreciated.

like image 313
nagytech Avatar asked Jan 13 '23 19:01

nagytech


2 Answers

Found a way to achieve this in sbt config file:

javaOptions in (Test, run) += "-Djava.awt.headless=true"
like image 178
mcveat Avatar answered Jan 25 '23 03:01

mcveat


I do not know on how do you add VM arguments in the sbt settings. But given for a normal application, if you wish to not wish show the app on the dock, use:

-Djava.awt.headless=true

VM argument. Adding this should suffice.

Beware: If you have any JNI code and it uses OS events, then it sometimes result in some abnormal behavior with application not getting the events. Else it works fine.

like image 33
Jatin Avatar answered Jan 25 '23 03:01

Jatin