Judging by the stacktrace that you inserted into your post, I would assume that you do not have permission to read the file.
The File class allows you to perform useful file checks, some of which are:
boolean canExecute(); boolean canRead(); boolean canWrite(); boolean exists(); boolean isFile(); boolean isDirectory();
For example, you can check: exists () && isFile () && canRead () and print the best error message, depending on the reason you cannot read the file.
source share