My Java program opens a file and slowly writes to the file. When the operation is completed, the program closes the file and moves the file to its final resting place in another directory. The problem is that as the operation is running, another thread in the same Java program deletes the file. Windows will n…
Tag: delete-file
java Cannot delete file, being used by another process
I have this code and when I execute it it says java.nio.file.FileSystemException The process cannot access the file because it is being used by another process (in sun.nio.fs.WindowsException) In the sameSha1() I have this: I want to delete the file ‘SHA1.txt’. How can I do this? Answer I guess wi…