I am trying to capture screen shots in my JavaFX application using Robot
class,
this is the code which I used in my application:
Rectangle screenBounds = new Rectangle(Screen.getPrimary().getBounds().getWidth(),
Screen.getPrimary().getBounds().getHeight());
Robot robot = new Robot();
BufferedImage img = robot.createScreenCapture(new java.awt.Rectangle(
(int) screenBounds.getX(), (int) screenBounds.getY(), (int)
screenBounds.getWidth(), (int) screenBounds.getHeight()));
It is working perfectly in windows operating system, but showing an error of headless environment
in MAC OS at Robot robot = new Robot();