Java - Access is denied java.io.FileNotFoundException [duplicate]
This question already has an answer here: java.io.FileNotFoundException: (Access is denied) 4 answers I have the following code: List<FileItem> items = uploadHandler.parseRequest(request); for (FileItem item : items) { if (!item.isFormField()) { File file = new File("D:/Data"); } } When I am trying to save a file, I am getting the following error java.io.FileNotFoundException: D:\Data (Access is denied.) What could be the reason and how can I resolve this? I do have read and write permission on this folder. Julien When you create a new File , you are supposed to provide the file name, not only