對於這個愚蠢的問題感到抱歉。但我真的無法找到我在做錯的地方。請幫忙。我正在嘗試使用JSON解析文件。文件也在系統中。但它顯示filenotfound異常。其真令人沮喪。文件未找到來自FileReader的異常
片斷的我的代碼如下:
System.out.println("Please provide JSON file path : ");
filePathJson = "\"D:\\files\\test.xlsx\"";
//in.nextLine();
System.out.println("Please provide Excel file path : ");
filePathExcel = in.nextLine();
Object obj = parser.parse(new FileReader(filePathJson));
System.out.println("hii");
JSONArray array = new JSONArray();
和錯誤我得到:
Please provide JSON file path :
Please provide Excel file path :
"D:\\files\\test1.xlsx"
java.io.FileNotFoundException: "D:\files\test.xlsx" (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:137)
at java.io.FileInputStream.<init>(FileInputStream.java:96)
at java.io.FileReader.<init>(FileReader.java:58)
at JavaJsonSplitter.main(JavaJsonSplitter.java:50)
有人能指出我哪裏做錯了。
請忽略一個無用的sysout。
誰幹的,改變這兩個文件的硬編碼和給定爲u建議..仍然面臨着同樣的問題... – user2696466
@ user2696466:您可能會面臨另一個問題與文件名,但不是相同的問題。 –