java.io.FilePermission when reading from "user.dir"

761 views Asked by At

I am getting following error when reading the text file.

Test - Exception in thread "Thread-0" java.security.AccessControlException: access denied ("java.io.FilePermission" "C:CUR_SDKPkbZ17INTWDPsolWDP5_NI_PD24Towary.txt" "read") at zad2.Czytaj.run(Czytaj.java:25)

String fname = System.getProperty("user.dir")+"/Towary.txt";
try (BufferedReader scan = new BufferedReader(new FileReader(fname))) 

The excercise was to read from the eclipse workspace directory a .txt file.

0

There are 0 answers