We've a Mac Mini that does some automated testing from a brew Jenkins install, on a Mac Mini in our office, which we're using a test tool called "Genie", which at it's lower level, creates a java.awt.Robot
, but at sun.awt.HToolkit.createRobot
, a java.awt.HeadlessException
occurs.
java.awt.HeadlessException
at sun.awt.HToolkit.createRobot(HToolkit.java:160)
at java.awt.Robot.init(Robot.java:138)
at java.awt.Robot.<init>(Robot.java:96)
at com.adobe.genie.genieUIRobot.UIFunctions.<init>(Unknown Source)
at com.adobe.genie.executor.uiEvents.UIImage.<init>(Unknown Source)
Funny thing is that the exact same job works completely fine on my own MacBook Pro, from the exact same brew Jenkins install.
Really confused about it, and have tried some of the workaround answers that have popped on here, the launch script is:
java -Djava.awt.headless=false -jar /Developer/Genie/GenieScripts/Executor.jar --logFolder /tmp /Developer/Genie/GenieScripts/bin/scripts/TestScript.class
And then in the TestScript.java, there's
System.setProperty("java.awt.headless", "false");
System.setProperty("javafx.macosx.embedded", "true");
in a static {} block, in the constructor and in the start() function.
Both machines are fully up to date Mavericks OS machines.
So, for this particular instance, the way to get it working was to ensure that the Jenkins session was started as the real, logged in, head-full user.
With Genie, and obviously createRobot
though, they did.
So, to get things back up and running, we changed the user Jenkins
was running as to the real account on the Mac Mini, and then after that, we changed the way it was starting from a system service, starting before login, to a user service, starting after login, by that logged in user.
That was how I had, by accident and default, installed it on my laptop and hence why it had worked without incident for me.