Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Error While appending to Zip File

 
Sasanka Boxi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Experts,

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

Please help.

Here goes my code.

 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sasanka Boxi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have updated the code now...could you please verify once...
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if zos.close(); throwns an exception then oldzip isn't closed.
 
Sasanka Boxi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Recently we updated the JVM version, is this an issue with JVM
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic