[英]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. 我在我的apps目录上得到了filenotfoundexception,但是我的目录显然存在。 I'm doing this on my local machine. 我正在本地计算机上执行此操作。 I'm doing a very simple post to a servlet. 我正在做一个非常简单的帖子到servlet。 Does anyone knw what could be happening? 有人知道会发生什么吗?
it turns out this was due to my firewall (firestarter) blocking my servers ip address. 原来这是由于我的防火墙(firestarter)阻止了我的服务器的IP地址。 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. 假设“目录”是保存目录的File变量。
Try putting in something like: 尝试输入以下内容:
System.out.println("the directory exists = " + directory.exists());
and making sure it returns true. 并确保它返回true。
您是否对所有中间路径段具有遍历权限,并且对最终文件具有适当的权限?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.