views:

851

answers:

4

Hi, 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?

+1  A: 

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.

TofuBeer
A: 

is it "in plain view" (==on the file system) or inside a jar/war ? if its packaged up, you cant access it as a file and you need to use things like


this.getClass().getClassLoader().getResourceAsStream(fileName);

there's also getSYstemResourceAsStream, which is a static method os class ClassLoader ...

hatchetman82
A: 

Do you have traversal authority to all intervening path segments, and appropriate authority to the final file?

Software Monkey
A: 

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

Buffernet