I've been trying to add this code to my project :
public static void Save() throws HeadlessException, AWTException, IOException
{
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension Dim = tk.getScreenSize();
Rectangle screenRect = new Rectangle(Dim);
Robot r = new Robot();
BufferedImage screenCapturedImage = r.createScreenCapture(screenRect);
DateFormat dateFormat = new SimpleDateFormat("yyyy MM dd HH:mm:ss");
Date date = new Date();
String FileName = dateFormat.format(date);
ImageIO.write(screenCapturedImage, "png", new File("/home/caio/Desktop/"+FileName+".png"));
}
it gives me this error :
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: RoboCore.Print.Save
at Core.Start.main(Start.java:23)
Java Result: 1
I want to call this method to print the results on my screen, but this code won't work because it's not a main method, it seems very strange to me...