aspose file tools*
The moose likes Java in General and the fly likes How to delete tmp file in the case of abort. Finally block is not in the scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to delete tmp file in the case of abort. Finally block is not in the scope" Watch "How to delete tmp file in the case of abort. Finally block is not in the scope" New topic
Author

How to delete tmp file in the case of abort. Finally block is not in the scope

George Cui
Greenhorn

Joined: Dec 10, 2011
Posts: 5


when it abort the tmp file is still in the folder.
How to delete the tmp file in case?
thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

You just need to declare the variable in a scope which includes both the try-block and the finally-block.
George Cui
Greenhorn

Joined: Dec 10, 2011
Posts: 5
thanks, after adding
File tmp_file = null;
at the top, it works
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to delete tmp file in the case of abort. Finally block is not in the scope