Simple as the title states: Can you use only Java commands to take a screenshot and save it? Or, do I need to use an OS specific program to take the screenshot and then grab it off the clipboard?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Believe it or not, you can actually use
java.awt.Robotto ‘create an image containing pixels read from the screen.’ You can then write that image to a file on disk.I just tried it, and the whole thing ends up like:
NOTE: This will only capture the primary monitor. See GraphicsConfiguration for multi-monitor support.