troubleshooting Question

How to close a file in exception handling situation?

Avatar of 44rwsi
44rwsi asked on
Java
15 Comments1 Solution496 ViewsLast Modified:
Hi All,
   We are using JExcelApi for generating Excel output. It works perfectly allright. But, when used on a floppy its giving 'Insufficient Disk Space' which is true.
   Now we are in the catch block, we just need one thing - TO DELETE THAT INCOMPLETE FILE.
We tried the following
1. Tried to delete the file from that function itself - FAILED - The file is still being referred
2. Tried to close and then delete - FAILED - But close again is throwing the same exception.
3. Tried to delete the file after the function - Insense from where we called this 'exportExcel()' function - FAILED - The file is still being referred.

   Please suggest us how to close the file reference and delete that file. Anyway it wont be good to leave an incomplete file on the disk - Right???

Thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros