Skip to content
Advertisement

Headless environment error in java.awt.Robot class with MAC OS

I am trying to capture screen shots in my JavaFX application using Robot class,

this is the code which I used in my application:

JavaScript

It is working perfectly in windows operating system, but showing an error of headless environment in MAC OS at Robot robot = new Robot();

Advertisement

Answer

This is to answer my own question, after searching many resources.

I have used following code to disable headless environment, and the problem is solved.

JavaScript

Thanks.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement