Java - Access is denied java.io.FileNotFoundException [duplicate]
When you create a new File
, you are supposed to provide the file name, not only the directory you want to put your file in.
Try with something like
File file = new File("D:/Data/" + item.getFileName());
Not exactly the case of this question but can be helpful. I got this exception when i call mkdirs() on new file instead of its parent
File file = new java.io.File(path);//file.mkdirs(); // wrong! file.getParentFile().mkdirs(); // correct!if (!file.exists()) { file.createNewFile();}
I have search for this problem and i got the following answers:
"C:\Program Files\Apache-tomcat-7.0.69\"
remove the extra backslash (\
)- Right click the log folder in tomcat folder and in security tab give this folder as a write-permission and then restart the net-beans as an run as administrator.
Your problem will be solved