detect file is bein used by another process
Is there any way to check a file is being used by another process outside JVM ?Here is the problem that I run into it when trying to write over an existing file.
1.check if the file exists.
2.If it does, delete it.
3.Rewrite with the same file name.
The problem is if another process uses the same file, Java does not know, number 2 will return true but number 3 cant write to file since its being currently used. However Java still return true since number 2 was successful.
When the other process releases the file lock. The file gets deleted but not new file gets created.
Jay

