aspose file tools*
The moose likes Beginning Java and the fly likes Java Error While appending to Zip File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Error While appending to Zip File" Watch "Java Error While appending to Zip File" New topic
Author

Java Error While appending to Zip File

Sasanka Boxi
Greenhorn

Joined: Jan 04, 2011
Posts: 6
Hello Experts,

I am constantly getting the bellow error:
Could not rename zip file

Please help.

Here goes my code.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19695
    
  20

You still have an OutputStream to the file open. That means that Windows disallows renaming, deleting, etc. You can't delete or rename a file in Java unless all streams etc to it are closed. Also, the file to rename to cannot exist yet.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Sasanka Boxi
Greenhorn

Joined: Jan 04, 2011
Posts: 6
I have updated the code now...could you please verify once...
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

if zos.close(); throwns an exception then oldzip isn't closed.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Sasanka Boxi
Greenhorn

Joined: Jan 04, 2011
Posts: 6
Recently we updated the JVM version, is this an issue with JVM
 
 
subject: Java Error While appending to Zip File