Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing file deletion on Windows from Java

Is there a programatic way from java to force a file deletion on windows even if the file is locked by some process? I cannot kill the process that locks the file.

like image 514
el_eduardo Avatar asked Jun 25 '26 22:06

el_eduardo


1 Answers

you can go through JNI. But the whole point of locking was NOT to allow for deletion from another process.

So, unless you're running Windows 9x, this might be impossible to do.

That said, if you're aware of a way to do it using WIN32, then you might be able to do it in java using JNI.

like image 54
anjanb Avatar answered Jun 27 '26 11:06

anjanb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!