[問題] command line 讀取資料
想請問各位要如何在command line 中加入資料
程式碼如下:
BufferedReader br_f= new BufferedReader(new InputStreamReader(System.in));
String getfileName = br_f.readLine();
FileReader fr = new FileReader(getfileName);
我在command line 中輸入 java project.java < test.txt 會跑出錯誤訊息如下:
Exception in thread "main" java.io.FileNotFoundException: 4 (No such file
or directory)
但我如果先輸入java project.java enter輸出後 再打test.txt又可以正確執行
想請問是否有方法可以解決
麻煩各位了
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.117.16.122
→
02/27 03:25, , 1F
02/27 03:25, 1F
→
02/27 03:34, , 2F
02/27 03:34, 2F
推
02/27 08:18, , 3F
02/27 08:18, 3F
→
02/27 08:46, , 4F
02/27 08:46, 4F
→
02/27 10:24, , 5F
02/27 10:24, 5F
→
02/27 11:41, , 6F
02/27 11:41, 6F
java 近期熱門文章
PTT數位生活區 即時熱門文章