In my 64-bit Windows 7 window using NTFS and Java 7, the only thing that worked reliably for me:
boolean canDelete = file.renameTo(file)
This is surprisingly simple and also works for folders that have an “open” or “locked” file “somewhere below”.
Other things I tried and created false positives: aquire FileLock, File # canWrite, File # setLastModified ("touch")
source share