JRuby Toolkit Robot example - how take a screenshot of your desktop
By Alvin Alexander. Last updated: June 3 2016
Here's some sample JRuby code that I just used to take a screenshot of my desktop. It uses the Toolkit
and Robot
classes from Java to make it all happen. It could probably be a little shorter, but I don't know much about JRuby yet. I also had a problem getting the Java File
class to work properly, and referencing it as shown was the only way I could get it to work.