我得到「語法錯誤令牌‘(’{有望」上試一試(BufferReader ..線在Eclipse,當我嘗試使用新的Java 7的嘗試,與-resource。(下面的代碼片段)這是直接從Java NIO教程複製http://download.oracle.com/javase/tutorial/essential/io/file.htmlJava 7中的try-與資源語法錯誤
我已經配置到最新java7位置構建路徑,我知道這是正確配置,因爲我使用其他java.nio中的功能,如路徑和SimpleFileVistor沒有任何問題。有什麼建議? 謝謝!
try(BufferedReader reader = Files.newBufferedReader(file, charset)) {
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
}catch (IOException x) {
System.err.format("IOException in reading " + file.getFileName().toString()+ x);
}
return testCaseNames;