1. import net.lingala.zip4j.ZipFile;
  2. import net.lingala.zip4j.exception.ZipException;
  3. import java.io.IOException;
  4. public class SampleClass{
  5. public static void main(String[] args)
  6. throws ZipException,
  7. IOException{
  8. ZipFile zip = null;
  9. try{
  10. zip = new ZipFile
  11. ("myzip.zip");
  12. zip.extractFile("img.jpg", "extracted");
  13. zip.extractFile("folder/", "extracted");
  14. }
  15. finally{
  16. if(zip != null)
  17. zip.close();
  18. }
  19. System.out.println
  20. ("main thread end");
  21. }
  22. }