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
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 19216

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
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Java Error While appending to Zip File
 
Similar Threads
Could you unzip a file with a java program
zip files without path info...
Windows does not recognize Java created ZIP
Converting Zip file to bytearray and vice versa
writing data to zip file