aspose file tools*
The moose likes Java in General and the fly likes Delete file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Delete file" Watch "Delete file" New topic
Author

Delete file

Adam Teg
Ranch Hand

Joined: Jul 10, 2007
Posts: 58
In my program, I open a file and after processing try to delete it. It will not delete. When I try to delete it mannually, it tells me it is being used by my program. I close the file readers in my program, what else can I do?

Thanks
Ravi Kotha
Ranch Hand

Joined: Mar 02, 2006
Posts: 53
I had a similar problem. Then I put the statement after closing all streams to read/write. It got deleted successfully. In your case you are saying you have closed streams. Can you give a rough picture of your code?
Michael Raymond Jr.
Ranch Hand

Joined: May 16, 2005
Posts: 178
Originally posted by James Steblay:
In my program, I open a file and after processing try to delete it. It will not delete. When I try to delete it mannually, it tells me it is being used by my program. I close the file readers in my program, what else can I do?

Thanks


do what the other guy said...

or maybe try to null the object when you are done with it and create a new one witht the absolute path name, then .delete();


Scooby Snacks for everyone...<br /> <br />SCJA, SCJP 1.4
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Delete file