Java7 WatchService - Access Denied error trying to delete recursively watched nested directories (Windows only)?

If you are watching a directory on Windows then the WatchService implementation has an open handle to that directory (that's the way that Windows works). That open handle doesn't prevent the directory from being deleted but it does prevent the directory's parent from being deleted immediately. As soon as you delete the watched directory then the handle is closed but it's possible that you will attempt to delete the directory before the handle is closed.

When that happens you will get the access denied that you are seeing. I assume it works fine for you if you retry and this is because the handle will be closed by the time you retry. The JDK can use Windows watch subtree capability but only if you use the JDK specific FILE_TREE modifier.

Thanks for providing the note about the Windows-specific FILE_TREE modifier. There was a similar comment (which I missed) in the related bug in the Java 7 Bug Database: bugs.sun. Com/bugdatabase/… – FR.

Jun 9 at 23:04 Also note that in Eclipse, I had to lower the Error caused by the Access Restriction on rt. Jar to a Warning. See lkamal.blogspot.Com/2008/09/… – FR.

Jun 10 at 1:22.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions