我收到'File not found!'不管我做什麼。存儲在FileInputStream中的文件在哪裏?
FileInputStream fin;
try {
fin = new FileInputStream("foo.txt");
String str = IOUtils.toString(fin);
System.out.println(str);
} catch (FileNotFoundException f) {
System.out.println("File not found!");
}
它存在於目錄中。仍然有錯誤。 – user5450665
編輯:工作後給完整的路徑,但不明智。謝謝你的幫助。 – user5450665
好奇,你使用任何IDE,或者你是否在命令行中使用java。 – Pavan