我准备了一个用于捕获屏幕快照的Java存储过程。我正在使用sql developer调用它。
在调用它时,出现“ ORA-29532:Java调用因未捕获的Java异常而终止:java.lang.UnsatisfiedLinkError:java.awt.Toolkit.initIDs”错误。 我该如何解决?
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED demoskr1 AS
package ScreenShot;
import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.*;
class demoskr1
{
public static void main(String args[])
{
System.setProperty("java.awt.headless", "false");
Robot awt_robot= null;
try{
Thread.sleep(5000);
awt_robot = new Robot();
String path = "C:\\Users\\pbafna\\workspace\\shot.jpg";
BufferedImage Entire_Screen = awt_robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(Entire_Screen, "jpg", new File(path));
System.out.println("Screenshot saved");
}
catch (IOException ex) {
System.out.println("Something went wrong1.");
}
catch (InterruptedException ex1) {
System.out.println("Something went wrong2.");
}
catch (AWTException e) {
System.out.println("Something went wrong.");
}
}
};