如何实时删除文件?
在一个正在运行的server系统中调用File的delete()方法居然不能删除文件。仔细看了jdk文档才发现有这么一段:
Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates. Deletion will be attempted only for normal termination of the virtual machine.
也就是说只有正常终止虚拟机后才能删除文件。
那如何在程序运行的过程中彻底删除文件呢?