简体   繁体   中英

java.io.FileNotFoundException No such file or directory error but directory exists

I'm getting the filenotfoundexception on my apps directory but my directory clearly exists. I'm doing this on my local machine. I'm doing a very simple post to a servlet. Does anyone knw what could be happening?

it turns out this was due to my firewall (firestarter) blocking my servers ip address. I allowed the exception and everything worked.

A few of thoughts (hopefully you haven't tried them :-):

Do you have read access to the directory?

Try putting in something like:

System.out.println("the directory = " + directory);

Assuming "directory" is the File variables that holds the directory.

Try putting in something like:

System.out.println("the directory exists = " + directory.exists());

and making sure it returns true.

您是否对所有中间路径段具有遍历权限,并且对最终文件具有适当的权限?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM