How do I securely delete files in java? I tried the code at javafaq.nu, but the problem is you can't actually delete the file on windows once it has been mapped due to this bug.
Then I tried just using sysinternals sdelete on windows, but you have to click a usage agreement the first time you use it which I want to avoid.
解决方案
On a journaling filesystem like NTFS there is actually no way to securely erase a single file without wiping all the free space on the drive. The problem is that the new blocks (which you've presumably overwritten with random data) are not guaranteed to be in the same place on disk as the old ones.
Utilities like sdelete might work for you, but one could simply replace that executable with one that does nothing to thwart that method of defence.
In order to keep your data secure, the only real solution you have is to completely encrypt the drive.