I guess you could copy the zip file without copying the comment.
public static void removeComment(Path file) throws IOException {
Path tempFile = Files.createTempFile("temp", ".zip");
copyZipFile(file, tempFile, false);
Files.move(tempFile, file, StandardCopyOption.REPLACE_EXISTING);
}
public static void copyZipFile(Path file, Path newFile, boolean copyComment) throws IOException {
try (ZipFile zipFile = new ZipFile(file.toFile());
ZipOutputStream outputStream = new ZipOutputStream(new BufferedOutputStream(Files.newOutputStream(newFile)))) {
if (copyComment) {
outputStream.setComment(zipFile.getComment());
}
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
copyEntry(zipFile, outputStream, entries.nextElement());
}
}
}
private static void copyEntry(ZipFile zipFile, ZipOutputStream outputStream, ZipEntry entry) throws IOException {
ZipEntry newEntry = (ZipEntry) entry.clone();
outputStream.putNextEntry(newEntry);
IOUtils.copy(zipFile.getInputStream(entry), outputStream);
}