【发布时间】:2011-06-08 20:50:51
【问题描述】:
不确定是否可以在此处请求此类帮助,如果不可以,请告诉我。
它必须在明天之前完成,它还没有完全完成,但现在应该可以工作了。我正在尝试使用 Eclipse 调试器(不太习惯)。
好的,我在另一个项目文件夹中有一个名为“调试”的旧类,它是一个调试测试。我没有给它起这个名字,这是一个任务。它似乎引起了一些问题,将其删除,现在我的堆栈跟踪要小得多。
我尝试调试 Board 构造函数,将构造函数中的原始代码添加到方法中,并尝试在构造函数中运行该方法。这没有任何区别,但仍然如此。
现在堆栈跟踪如下所示:
Thread [main] (Suspended)
Board(Object).<init>() line: 20
Board.<init>() line: 9
Game.<init>() line: 15
Game.main(String[]) line: 11
板子构造器:
公共课板{
private int COLUMNS = 8;
private int ROWS = 8;
private Square[][] grid;
public Board(){
addGrid();
}
public void addGrid(){
grid = new Square[COLUMNS][ROWS];
for(int row = 0; row < 8; row++){
for(int col = 0; col < 8; col++){
grid[col][row] = new Square(this);
}
}
}
方形构造函数:
public class Square {
private Piece piece;
private Board board;
public Square(Board b){
board = b;
}
在我的断点中,我注意到了这一点:
ArrayIndexOutOfBoundsException: caught and uncaught
又试了一次,结果和以前差不多:
Thread [main] (Suspended)
ClassNotFoundException(Throwable).<init>(String, Throwable) line: 217
ClassNotFoundException(Exception).<init>(String, Throwable) line: not available
ClassNotFoundException.<init>(String) line: not available
URLClassLoader$1.run() line: not available
AccessController.doPrivileged(PrivilegedExceptionAction<T>, AccessControlContext) line: not available [native method]
Launcher$ExtClassLoader(URLClassLoader).findClass(String) line: not available
Launcher$ExtClassLoader.findClass(String) line: not available
Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not available
Launcher$AppClassLoader.loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available
Board.addGrid() line: 14
Board.<init>() line: 10
Game.<init>() line: 15
Game.main(String[]) line: 11
【问题讨论】:
-
当然,我添加了 Board 类的第一部分。我尝试从断点开始,就在 Board 构造函数的第一行。它给了我几乎相同的例外。
标签: java eclipse debugging exception