ControlC ControlC · Pastebin

java-zip4j-tut-create-zip-or-add-file-to-zip-1

Pasted: Nov 27, 2024, 11:04:22 am · Views: 33
import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.exception.ZipException;

public class SampleClass{

public static void main(String[] args)
throws ZipException{
ZipFile zip = null;

try{
zip = new ZipFile("myzip.zip");
zip.addFile("img1.jpg");
zip.addFile("img2.jpg");
}
finally{
if(zip != null)
zip.close();
}

System.out.println
("myzip.zip has been created!");
}
}