" FileReadingTools"不在JAVA工作

时间:2014-11-18 13:25:38

标签: java

// Specify the full path to your file in here.
String datafile = "/home/rez/Desktop/data_example.txt";

double[][] mydata = FileReadingTools.getDoubleArray(datafile);

FileReadingTools给出错误 我想要一个工具来阅读桌面上的文本文件,如你所见

1 个答案:

答案 0 :(得分:0)

只需使用:

public void read() {
    String fileName = "your/path/yourFile.txt";

    try {
        List<String> lines = Files.readAllLines(Paths.get(fileName),
                Charset.defaultCharset());
        for (String line : lines) {
            System.out.println(line);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}