I am trying to capture screen shots in my JavaFX application using Robot class, this is the code which I used in my application: It is working perfectly in windows operating system, but showing an error of headless environment in MAC OS at Robot robot = new Robot(); Answer This is to answer my own question, after searching many resources.