Running `play test` on OSX makes Java app appear in dock

This will not be a serious problem, but the application steals focus every time it turns off.

The application icon displayed on the dock is called sbt.ForkMain .

I traced it to ebean.default="models.*" In the application.conf file. When this line is commented out, the application does not start. I am quite sure that this is due to the launch of the ebean server, but it does not work on any of my other machines.

I am using a new installation of OSX 10.8.3, and this happens even in the clean folder play new xxxx .

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

Any help would be appreciated.

+4
source share
2 answers

Found a way to achieve this in the sbt configuration file:

 javaOptions in (Test, run) += "-Djava.awt.headless=true" 
+5
source

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

 -Djava.awt.headless=true 

VM argument. Adding this should be sufficient.

Beware: if you have any JNI code and it uses OS events, sometimes this leads to some abnormal behavior so that the application does not receive events. Otherwise, it works great.

+4
source

Source: https://habr.com/ru/post/1494248/


All Articles