![](/img/trans.png)
[英]java.io.FileNotFoundException: No such file or directory Error
[英]java.io.FileNotFoundException No such file or directory error but directory exists
我在我的apps目錄上得到了filenotfoundexception,但是我的目錄顯然存在。 我正在本地計算機上執行此操作。 我正在做一個非常簡單的帖子到servlet。 有人知道會發生什么嗎?
原來這是由於我的防火牆(firestarter)阻止了我的服務器的IP地址。 我允許例外,一切正常。
一些想法(希望您還沒有嘗試過:-):
您對該目錄具有讀取權限嗎?
嘗試輸入以下內容:
System.out.println("the directory = " + directory);
假設“目錄”是保存目錄的File變量。
嘗試輸入以下內容:
System.out.println("the directory exists = " + directory.exists());
並確保它返回true。
您是否對所有中間路徑段具有遍歷權限,並且對最終文件具有適當的權限?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.