Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java reading txt.file - access denied?

I have created a txt file which I have saved in My Documents on my computer. I am trying to read the txt file through FileReader and BufferedReader. However, when I try to run the program I get the error message:

java.io.FileNotFoundException: <filelocation> (Access is denied)

Does anyone know what causes this, and how I might fix the problem? I have tried saving the document other places too, but I always get this message. I am sure the file path is correclty entered.

like image 643
Kristian Avatar asked Oct 25 '11 18:10

Kristian


1 Answers

java.io.FileNotFoundException: C:\Users\Kristian\Documents (Access is denied)

You are trying to read a directory, not a .txt file.

like image 160
user207421 Avatar answered Oct 07 '22 08:10

user207421