This content has been marked as final. Show 3 replies
File can be corruptThat will not throw a FileNotFoundException.
it can be locked by another applicationThat will throw a FileNotFoundException
the windows system is blocking your access for a host of reasonsThat's the general case of the previous special case.
the least of which is that something else has used it in the past few minutes and windows thinks it is still in use.That doesn't happen unless the file is currently in use, which you have already covered above.
EJP wrote:I would have to dissagree with you there. Not frequently, but on occasioin, I have had windows just not release a lock that is has on a file. I've had this happen with various editors--Word and Notepad are ones that recently come to mind. It has also happened to me doing a copy from one folder to another. Windows Media Player has also expressed a problem and also Excel and Access. I have had these problems in Windows 7, XP, and other previous Windows versions. And please do not think this is limited to accessing a file with Java--it has expressed in various MS development tools and even just using MS products--no programming outside of the shrink wrap MS product was used.
That doesn't happen unless the file is currently in use ...