Force file deletion on Windows with Java

Is there a programmatic way from java to force a file to be deleted in windows, even if the file is locked by some process? I cannot kill a process that locks a file.

+3
source share
3 answers

You can go through JNI. But the entire blocking point was NOT to allow removal from another process.

So, if you are not using Windows 9x, this may not be possible.

However, if you know a way to do this with WIN32, then you can do it in java using JNI.

+6
source

Windows, , OR OUT Java , , .

+3

Use Unlocker . Call it from Java as an external process.

+2
source

Source: https://habr.com/ru/post/1697950/


All Articles