用Java读取属性文件

时间:2016-02-22 17:21:56

标签: java filereader

我的代码无法读取属性文件。有人可以帮忙吗?打印无法找到该文件。

BufferedReader br = null;
String strLine = "";
try {
    br = new BufferedReader( new FileReader("C:/common-test/common-test/translationtest/messages_ja.property"));
    while( (strLine = br.readLine()) != null){
        System.out.println(strLine);
    }
} catch (FileNotFoundException e) {
    System.err.println("Unable to find the file: fileName");
} catch (IOException e) {
    System.err.println("Unable to read the file: fileName");
}

1 个答案:

答案 0 :(得分:0)

尝试使用此val foo = ("lorem", 2) val (lorem: String, bad: String) = foo // fail case class Bar(name: String, age: Option[Int]) val bar = Bar("Sam", None) val Bar(name, Some(age)) = bar // fail

\\

您确定要使用 "C:\\common-test\\common-test\\translationtest\\messages_ja.property" .property