FileNotFoundException would be better named CantAccessFileException. It addition to the file actually not being found (which you say is not the case), it might mean a permission problem (the Java program has no access rights), or maybe the file is still open by another process.
Ping & DNS - updated with new look and Ping home screen widget
Joined: Mar 05, 2006
If it's a file permission problem, do you know any workaround?
If it is a permissions problem, the "workaround" is to ask the owner of the file to change its permissions so you can read it. But that's probably you, and it probably isn't a permissions problem at all. It is maybe the problem where you don't understand the concept "current working directory".
Your code tries to look for the file in the current working directory, since you provide only the file's name and no path information. You seem to be assuming that your current working directory is the one where your Java source code is stored. This is not necessarily the case. It is whatever you set it to be before running the class. Or whatever your IDE set it to, if you are not running the class from the command line.