Reputation: 434
I have a strange error in Java trying to output some data. I have read and write access to the file. The file exists (yourFile.exists()
prints True
) but still I get the Java.io.FileNotFoundException
.
Sample code:
File yourFile = new File("./output/blah.txt");
FileOutputStream oFile = new FileOutputStream(yourFile);
Anyone knows anything I can try to fix this?
Upvotes: 0
Views: 1268
Reputation: 3650
Beware that FileOutputStream
's constructor can throw a FileNotFoundException
for several different causes:
FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason.
Upvotes: 1