【问题标题】:RuntimeException: Uncompilable source codeRuntimeException:无法编译的源代码
【发布时间】:2014-05-29 04:25:17
【问题描述】:

我需要有关程序的帮助。我不断收到这个在运行时发生的错误。如果有人可以让我知道它是否有其他问题,我也希望它。谢谢!

import java.io.*;
import java.util.*;

public class Lab2 {

    private String[][] data;


    public void readFile() {

        //Instantiate file object
        File f = new File("nameslist.txt");
        try {
            Scanner input = new Scanner(f);
            //open file for reading


            int x = input.nextInt();
            data = new String[x][3];
            int i = 0;

            while (input.hasNext() && i < data.length) {

                String name = input.nextLine();
                String[] nameArray = name.split(" ");
                data[i][0] = nameArray[0];
                data[i][0] = nameArray[1];
                data[i][0] = nameArray[2];

                i++;
            }
            input.close();
        } catch (IOException e) { //opening failed
            e.printStackTrace();
        }
    }


    public void outputNames() {
        System.out.println("First Name\tMiddle Name\tLast Name");
        for (int i = 0; i < data.length; i++)//output all elements
        {
            System.out.println(data[i][0] + "\t\t" + data[i][1] + "\t\t" + data[i][2]);
        }
    }


    public int nameSearch( String key) {
        for (int i = 0; i < data.length; i++) {
            if (key.equalsIgnoreCase(data[i][0])||key.equalsIgnoreCase(data[i][1])||key.equalsIgnoreCase(data[i][2])) {
                return i;
            }
        }
        return -1;
    }


    public void hashCodeMethod() {
        long hash = 5381;

        for (int i = 0; i < data.length; i++){
            long hashCode = 0;
            for (int j = 0; j < data[i].length; j++){
                for (int k = 0; k < data[i][j].length(); k++){
                    data[i][j].charAt(i);
                    hashCode += ((hash << 5) + hash) + data[i][j].charAt(i);

            }
          }
        }
    }
}

结束课程 Lab2

package lab.pkg2;

public class Lab2Client{
public static void main(String[] args) {
        Lab2 test = new Lab2();
        test.readFile();
        test.outputNames();
        test.nameSearch("Gamaliel");
        test.hashCodeMethod();


}   
}

我在运行时收到此错误:

Exception in thread “main” java.lang.RuntimeException:Uncompilable source code - 
Erroneous tree type: lab.pkg2.Lab2 

【问题讨论】:

    标签: java runtime-error runtimeexception


    【解决方案1】:

    删除 NetBeans 缓存 ~/.netbeans/6.9/var/cache/index/(该文件夹中的所有内容)

    为您的版本更改 6.9。

    【讨论】:

    • 我不知道如何关闭它??
    • 这并没有提供问题的答案。要批评或要求作者澄清,请在其帖子下方发表评论。
    • @realspirituals 我说过这不是答案,我寻求帮助,但我的请求被无缘无故拒绝了,即使他们也降低了我的观点,哈哈
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-08
    • 2022-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-06
    相关资源
    最近更新 更多