About File handle...
I am trying to delete a file using some code. But it's not getting deleted
with delete() function of 'File' class. I had been told that it might be
getting used by some other program. So Please tell me is there anyway
we can check whether the file is being used by some other program or not?
Thanks. Bye... :)
will you plz send me code snippet,
why don't u try something like this.
File file = new File("c:\\abc.txt");
......(SINGH IS KING):)
Because that is nonsense.
Originally Posted by ajaysingh87
Thanks Ajay, but I,ve already mentioned that delete() function isn't deleting the file. I want the way to know that whether the file I am trying to delete is being used by some other program.
Thanks. Bye :)
Presumably if delete() returns false then you can assume that either the user doesn't have permission to delete the file, or the file is in use. So check that flag and inform the user if it comes back false..."Cannot delete file blah. Either it is in use or you do not have sufficient privileges."
Something like that.
Do you have FileOutput/InputStreams open to the file you try to delete? That could be causing your problem as well... make sure you call the close() method on any FileXXXStream you use.
Originally Posted by Singing Boyo
Thanks for suggestion.... :)
I've already closed all the streams & buffers. So I think the handle isn't getting released unless Application is closed.