I am trying to add a file to existing zip archive. Using java.util.zip, I am able to add the file. But the only file in the archive is the file I just added. The method putNextEntry in ZipOutputStream class is losing the existing file in the archive.

Dhiren Bhatia

You will have to save the existing zip file in a temporary file, add the contents of the existing zip file to the temporary file and then add the new contents you want to update the zip file with.

The java.util.zip api's do not provide random access to zip files.