Unzip issue: Could not delete the zip file after unzip it

I have issue with the following code, the purpose is to unzip first then delete the zip file. But I could not delete the zip file. When I put a break point before my delete() call, I manually delete it and get the file is used by another process. Please help. Here is my code;
try{
File primeZip = new File(dir, fileName);
ZipInputStream zipStream = new ZipInputStream(new FileInputStream(primeZip));
     ZipFile zf = new ZipFile(primeZip);
     OutputStream out = null;
     for (Enumeration em = zf.entries(); em.hasMoreElements();){
          String fileName = em.nextElement().toString();
          out = new FileOutputStream(fileName );
          byte[] buf = new byte[16384];
          int len;
          while ((len = zipStream.read(buf)) > 0) {
               out.write(buf, 0, len);
          out.flush();
          out.close();
     out.flush();
               out.close();
               zipStream.close();
primeZip.delete();
}catch(FileNotFoundException e){          
}catch(IOException e){         
}

I put close() for ZipFile object which is zf.close() befoer I delete the zip file resolve this issue.
Thanks.

Similar Messages

  • Could not download the ordered file after five attaempts due to network problem

    Hi,
    Could not download the ordered file after five attaempts due to network problem.
    Help required.
    Regards,
    Nilesh Shah.

    http://prodesigntools.com/tag/ddl
    http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html
    Mylenium

  • Sender File adapter not deleting the source file after reading

    Hi everyone,
    In the sender Communication channel i have choosen the "Delete" option after reading the source file. But it is reading the file, but it is not deleting the file. I have checked the file status. it is with full persmission.
    can anyone give solution to this.
    Thanx
    Bala

    Hi,
    1. set the mode to delete
    2. make sure the file is "deletable"
    3. check xiserver:port/MessagingSystem/monitor log to see what happens with the file
    (chec both audit and log in that link)
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • ColdFusion could not delete the file [file path] fo

    Using the <cffile> tag I write a file to the server and
    display the outputed file in my browser. I then try to delete the
    file. I get the error message ColdFusion could not delete the file
    [file path] for an unknown reason. If I wait 60 seconds I can
    successfully delete the file. Using the freeware prodram Unlocker I
    know that it is a jrun.exe process that is preventing the deletion
    of the file for the 1 minute after the file has been created.
    Is there a known workaround or fix for this issue?

    Are you using CFlock when you write or create the file? If so
    that will prevent the file from being deleted until the lock is
    released.

  • ColdFusion could not delete the file

    Good day all im getting this error. cant figure it out
    "ColdFusion could not delete the file
    c:\ColdFusion8\wwwroot\Jewel\images\stock\203083.jpg for an unknown
    reason"
    I tried installing the 801 update the patch using :
    http://kb.adobe.com/selfservice/viewContent.do?externalId=kb403622&sliceId=1
    http://kb.adobe.com/selfservice/viewContent.do?externalId=kb403411&sliceId=1
    However this does not seem to be working,... but the file is
    there...
    Does anyone have a solution to this problem

    you sure you have all hotfixes installed? this was definitely
    fixed in
    one of the recent ones...
    also, i am no quiet sure about referencing [previous] cffile
    inside
    another cffile tag:
    <cffile action="rename"
    source="#dirlocation#\images\stock\#CFfile.serverfile#"
    destination="#dirlocation#\images\stock\#FORM.code#.jpg">
    see if setting a RESULT attribute in your cffile
    action='upload' tag and
    referencing that instead in your cffile action='rename'
    solves the
    problem...
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • "Windows could not start the offline files service on local computer. Error 3: The system cannot find the path specified"

    Using Windows 8.1 Pro on Toshiba Satellite i7 Laptop with 8Gb Ram
    After upgrade from Windows 8 Pro to 8.1 Pro, the Offline Files/CSC service refuses to start and gives the error message:
    "Windows could not start the offline files service on local computer. Error 3: The system cannot find the path specified"
    Before the upgrade, offline files worked fine... how do I re-enable offline files?

      I had a similar issue -  couldn't make any files available offline.
    I found that the offline folder service would not start
    This was because the CSC permission were totally screwed.  I had to take ownership of each folder and file, one by one, then grant everyone full access.
    then delete the full contents of the CSC folder
    format the CSC database using the registry fix then reboot
    in control panel, disable the offline files,  reboot, then re-enable.  and now its working :)
    2hrs to resolve this, with grateful thanks to this thread and some others.
    damn windows8

  • "Time Machine could not delete the backup disk"

    This morning, I got the "Time Machine must create a new backup for you" message referred to here:  http://pondini.org/TM/C13.html
    I went ahead and told it "start new backup" but after a few minutes, got this message, ending in error message -1:  "Time Machine could not delete the backup disk."  It did not reference a sparsebundle file or some other specific file name as I've seen in some other threads, and I haven't been able to find this exact issue anywhere in the forum or on Pondini's page.
    I went ahead and told it manually to do a new backup, but I am concerned that it will "lie to me" about the verifiability of the files per Pondini's page above (orange box at the bottom).  I'll attempt to force it to manually verify once this backup completes to see what happens, I guess.
    I'd appreciate any input.

    And now an effort to manually start a backup produces this error:  "This backup is too large for the backup disk. The backup requires 233.73 GB but only 188.30 GB are available."

  • Why does the new operating system not delete the moved files from their original location - it seems like an enormous waste of space, time and effort to clean up every file once you've moved it

    Why does the new operating system not delete the moved files from their original locations - it seems like an enormous waste of space, time and effort to clean up every file once you've moved it - also, when transferring large amounts of files it becomes a very large problem remembering which files were transferred and which not.

    You're going to need to be more specific, as I'm not quite sure I understand what you're talking about.
    If you're referring to copying from an external hard drive or flash drive, and you want to actually move files rather than copy them, you can hold down the option key to force it to do a "move" rather than a "copy." This is not new behavior, though... the Mac OS has worked this way as long as I can recall (and I've been using it since 1984).
    If you're having a problem with trying to move files from one place to another on a single drive causing them to be copied instead, that is likely because of some permissions issue preventing you from actually being able to move them.

  • Time Machine Backup Error. Time machine could not delete the backup disk image .sparsebundle

    Time Machine is giving an error message.  Time Machine couldnt complete the backup.  I am using the Seagate GoFlex Home.  Error message states Time Machine could not delete the backup disk image "/volumes/Go Flex Home Backup/iMAc.sparsebundle".  Does anybody have any ideas?

    I have deleted all files in the Time Machine backup via Windows, Finder, and GoFlex UI.
    I think this is your problem.. you need to follow the exact setup from seagate to get TM running again.. please read the manual... I do not have one but I do have another brand of NAS and setting up TM involves a fairly complex set of instructions.. because it is not a native Apple device.. your computer does not recognise it as TM capable.. you need to use the work around the manual will explain.

  • Trying to update creative cloud, comes error: The installation program could not access the important files / directories. Try to run the installer again. (Error code: 43), please contact customer support. The same error comes updating Muse. Mac 10.9.5. W

    Trying to update creative cloud, comes error: The installation program could not access the important files / directories. Try to run the installer again. (Error code: 43), please contact customer support. The same error comes updating Muse. Mac 10.9.5. What shall I do?

    Alauda_positos I would recommend reviewing your installation log files to determine the exact directory which the installer is unable to access.  You can find details on how to locate and interpret your installation log files at Troubleshoot install issues with log files | CC - http://helpx.adobe.com/creative-cloud/kb/troubleshoot-install-logs-cc.html.  You are welcome to post any specific errors discovered to this discussion.
    For information on how to adjust file permissions please see Error "Exit 6" or "Exit 7" | Install log | Read, write, system file errors | CS5, CS5.5 - http://helpx.adobe.com/creative-suite/kb/error-exit-6-exit-7.html.

  • "Could not locate the Resources file in the Configuration folder"

    While opening DW cs5 on my iMac OS X 10.7.5 a window came up that says:  "Could not locate the Resources file in the Configuration folder. This file is required to run Dreamweaver. Please reinstall the application."
    After downloading and reinstalling Adobe Creative Suite CS5 yesterday per the instruction of Adobe tech support, the application still had the same message when I attempt to open it.  Not sure where else to turn.  Please advise.  Thanks

    See if this previous thread regarding the same issue will help:
    http://forums.adobe.com/message/2274699#2274699
    Nadia
    Adobe Community Expert : Dreamweaver
    Unique CSS Templates | Tutorials | SEO Articles
    http://www.DreamweaverResources.com
    Web Design & Development
    http://www.perrelink.com.au
    http://twitter.com/nadiap

  • Error: Outlook could not create the work file. Office 2013

    I was having issues with Windows 8.1 store apps not working and it was suggested to sync my account licenses.  I did that but it did not correct my problem.  I then ran the troubleshooter app. The troubleshooter found several issues that it
    fixed but I cannot remember what they were.
    So here's my problem.  Now, when I open Outlook (2013) I get the error "Outlook could not create the work file."  
    Any suggestions?

    Glad to hear that you have found a solution and thank you for sharing it here, it will be helpful to other community members who have same questions.
    Cheers,
    Steve Fan
    TechNet Community Support

  • Multiple "slapd[46]: could not load the replica file" Errors

    Hi,
    We've got an OD master (10.4.8) that sporadically falls into a state where it reports the error "slapd[46]: could not load the replica file." many times over in the system log. It will start this with no warning and when everything is running just fine, but once it has started there errors build up until it is reporting them up to 20 times a second. Usually once it gets to this stage directory services start to suffer badly across the network and all connected servers. We usually have to reboot various servers at this point including the ODM in order to get services up and running again. After the reboots sometimes the problem will just disappear, sometimes it will just start building up again.
    We only have one other replica (down from 4) which is on a separate subnet across a WAN. We managed to get rid of the problem for a while by getting rid of the replicas on the local subnet, but it just pops back up again for no apparent reason.
    We attempted to install a new ODM with a brand spanking PW server a while ago and new replicas, but hit the same issue sometime into the install.
    The only time I've ever seen an issue with this many errors being reported so often it turned out to be a network loop, but I know there is not one present now. I did wonder about a rogue device on the network causing issues but I'm not fixed on this.
    Can anyone give me any ideas where to start looking for a resolution?
    Cheers
    Dan

    Step 1: Download subinacl.msi from the link
    http://go.microsoft.com/fwlink/?LinkId=23418 and install it.
    Step 2: Download my modified version of reset.cmd from
    http://gerger.com/o/assets/x/?id=22540 and save the file in 'C:\Program
    Files\Windows Resource Kits\Tools'.
    Step 3: Open Command Prompt as Administrator and type the following without
    quotes (hit Enter):
    'cd c:\program files\windows resource kits\tools'
    Step 4: Now type 'reset.cmd' and hit Enter (without quotes)
    You will see the Command Line Tool running for some seconds. The issue
    should have been fixed and Quicktime should run again.
    Enjoy!

  • MS Office 2004 reports "Word could not create the work file."

    I have searched the world for the solution and apparently nobody else has this problem. When opening any document (.doc) Word will report "Word could not create the work file. Check the amount of disk space on your start up drive."
    There are 40 gigs free. There is 2 gig of memory. It's the only app open.
    Is there a solution to this problem other then not using Word at all?

    I'm learning more about the doc file in question.
    Evidently it was created on Windows about 4 years
    ago. If I Save As... the file and click the
    Compatibility button it complains about a missing
    "linked" file. While this might be the cause of the
    problem there doesn't seem to be any way of fixing it
    short of finding a time machine and wacking the
    creator before they wrote a word. If I go ahead and
    save the document Word crashes and corrupts the
    original file (err the back up of the back up of the
    original file).
    I think you may have to give up on this one.
    A "linked file" is a reference pointer within the main word document that tells word to locate another file and incorporate it into the document by reference (but not include the actual contents of the linked file)
    Since you say "If I Save As... the file and click the Compatibility button..." you can get into the document.
    So try turning on invisibles, and find the reference to the linked file. You may also be able to find it by turning on Document Map.
    Delete the link, and that should take care of the crashing problem.
    Of course, your file will not be 'complete' but thats a differnet problem.

  • Error: "The workflow could not delete the list item"

    Have set up 2 lists:  Events and EventsArchive.  They have all the same fields.  I have created a workflow in SPD using an impersonation step (I have Full control of the site/site collection).  Workflow is essentially this:
        If Curent Item:Expired 
    equals
    Yes
           Copy item in Current Item to
    EventsArchive
           then Delete item in
    Current Item.
    The item is copying over to the EventsArchive list just fine, but the "delete" part is not happening.  Instead, I get the following error:
    The workflow could not delete the list item. Make sure the list exists and the user has permissions to delete items in the list.
    The list obviously exists (or I wouldn't be able to copy an item from it), and I have as much permissions as anyone can have, so I'm not sure where else to turn with this. 
    Thanks in advance for your help!

    Hi,
    To test the issue, I create a simple workflow without using Impersonation step:
    It works.
    Could you please create new lists to avoid custom settings and test the issue again?
    Similar thread:
    https://social.msdn.microsoft.com/Forums/office/en-US/3fa94026-4487-4e4c-a5b4-12a79d6ee6a2/workflow-delete-item-not-working?forum=sharepointcustomizationprevious
    Regards,  
    Rebecca Tu
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

Maybe you are looking for