用于Netbeans处理的线程“main”java.lang.StackOverflowError中的异常

时间:2014-02-05 01:34:39

标签: java netbeans processing

每当我运行主类时,如下所示,

 package gardeningmania;

 import processing.core.PApplet;
 import java.io.File;

 public class GardeningMania {

 public static void main(String[] args) {
    PApplet.main(new String[]{/*"--present",*/ "gardeningmania.Game"});
   Game.main("null"/*"gardeningmania.Game"*/);
    File currentDir = new File("."); getAllFilse(currentDir);
}
}

我收到此错误:

错误代码

线程“main”中的异常java.lang.StackOverflowError

at java.util.Hashtable.put(Hashtable.java:437)
at sun.java2d.Disposer.add(Disposer.java:139)
at sun.java2d.Disposer.addRecord(Disposer.java:107)
at sun.awt.image.BufImgSurfaceData.initRaster(Native Method)
at sun.awt.image.BufImgSurfaceData.createDataIC(BufImgSurfaceData.java:256)
at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:86)
at sun.awt.image.BufImgSurfaceManager.<init>(BufImgSurfaceManager.java:55)
at sun.awt.image.SurfaceManager.getManager(SurfaceManager.java:78)
at sun.java2d.SurfaceData.getPrimarySurfaceData(SurfaceData.java:273)
at sun.java2d.SunGraphicsEnvironment.createGraphics(SunGraphicsEnvironment.java:180)
at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1154)
at java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1142)
at processing.core.PFont.<init>(PFont.java:227)
at processing.core.PFont.<init>(PFont.java:328)
at processing.core.PApplet.createFont(PApplet.java:6560)
at processing.core.PApplet.createFont(PApplet.java:6488)
at gardeningmania.Game.<init>(Game.java:497)
at gardeningmania.ImageLoader.<init>(ImageLoader.java:12)
at gardeningmania.Game.<init>(Game.java:524)
at gardeningmania.ImageLoader.<init>(ImageLoader.java:12)

任何人都可以解释这个错误信息的含义吗?

1 个答案:

答案 0 :(得分:0)

java.lang.StackOverflowError指示方法调用堆栈已达到其最大大小。它通常表示一个错误退出递归(例如,无需完成就无限地调用方法)。

至于你的情况,我们需要看gardeningmania.Game构造函数,因为这是问题发生的地方,否则我们只能推测这个。