When I use SimpleCaptcha, I receive this error:
Exception in thread "main" java.lang.NoSuchMethodError: disposeLater
at java.awt.Component.initIDs(Native Method)
at java.awt.Component.<clinit>(Component.java:579)
at sun.awt.windows.WToolkit.initIDs(Native Method)
at sun.awt.windows.WToolkit.<clinit>(WToolkit.java:106)
at sun.awt.Win32GraphicsEnvironment.<clinit>(Win32GraphicsEnvironment.java:51)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at javava.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1135)
at nl.captcha.text.renderer.DefaultWordRenderer.render(DefaultWordRenderer.java:65)
at nl.captcha.Captcha$Builder.addText(Captcha.java:145)
at nl.captcha.Captcha$Builder.addText(Captcha.java:121)
at nl.captcha.Captcha$Builder.addText(Captcha.java:111)
at com.sohu.nl.test.simpleCaptcha.main(simpleCaptcha.java:29)
This is my code:
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.out.println("test");
Builder captchaBuilder = new Builder(10, 100);
captchaBuilder.addText();
Captcha captcha = captchaBuilder.build();
File file = new File("D:/a.jpeg");
ImageIO.write(captcha.getImage(), "JPEG", file);
}