为什么我的Java应用程序会出现致命错误?

为什么我的Java应用程序会出现致命错误?,java,Java,我从来没有见过这个,也许这是jvm中的一个bug 我添加了一些代码来解决数独问题: private boolean solve( int row, int col, Cell[][] cells ) { if ( row == NUM_PUZZLE_ROWS ) { row = 0; col++; if ( col == NUM_PUZZLE_COLUMNS ) return true; }

我从来没有见过这个,也许这是jvm中的一个bug

我添加了一些代码来解决数独问题:

private boolean solve( int row, int col, Cell[][] cells )
{
    if ( row == NUM_PUZZLE_ROWS )
    {
        row = 0;
        col++;
        if ( col == NUM_PUZZLE_COLUMNS )
            return true;
    }
    if ( cells[row][col].getValue() != 0 )  // skip filled cells
        return solve( row + 1, col, cells );

    for (int val = 1; val <= NUM_PUZZLE_ROWS; val++)
    {
        if ( isPossible( row, col, val, cells ) )
        {
            cells[row][col].setValue( val );
            if ( solve( row + 1, col, cells ) )
                return true;
        }
    }

    cells[row][col].setValue( 0 ); // reset on backtrack
    return false;

}

private boolean isPossible(
        int row, int col, int val, Cell[][] cells )
{

    //check the row
    for (int r = 0; r < 9; r++)  // row
    {
        //no duplicates permitted
        if ( val == cells[r][col].getValue() )
            return false;
    }


    //check the column
    for (int c = 0; c < 9; c++) // col
    {
        //no duplicates permitted
        if ( val == cells[row][c].getValue() )
            return false;
    }

    int rowOffset = (row / 3) * 3;
    int colOffset = (col / 3) * 3;

    //check the 3x3 box
    for (int r = 0; r < 3; ++r)
    {
        for (int c = 0; c < 3; ++c)
        {
            if ( val == cells[rowOffset + r][colOffset + c].getValue() )
            {
                return false;
            }
        }
    }

    return true; // no violations, so it's possible
}

private boolean solve( Cell[][] cells )
{
    resetPuzzle();
    return solve( 0, 0, cells );
}

public boolean solve()
{
    return solve( cells );
}
private boolean solve(int行、int列、单元格[][]单元格)
{
如果(行==NUM\u行)
{
行=0;
col++;
如果(列==NUM\u列)
返回true;
}
if(cells[row][col].getValue()!=0)//跳过填充的单元格
返回解算(行+1、列、单元格);

对于(int val=1;val您在Java中发现了一个bug,除非您有一些本机代码没有告诉我们。

那么您应该将其作为bug提交。确保包含完整的程序以及对它的任何输入。CLASSPATH=;C:\program Files\Java\jre6\lib\ext\QTJava.zip似乎是不可靠的?QTJava.zip做什么,您绝对有必要是否将其保存在lib/ext文件夹中?