It will exrect the contents of the compressed zip file and write the contents in a seperate file.
package Alltest; // package name where u create this class import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class xtractZipFile { // Extracts a zip file public void extractZipFile() { try { String zipFileName = "C:/Documents and Settings/313915/Desktop/Hi/Parent Satelitte report-FS.zip"; // Path of your compressed file String extractedFileName = "C:/Documents and Settings/313915/Desktop/Hi/extracted.doc"; // path where you want the file to be written //Create input and output stream ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName)); OutputStream os = new FileOutputStream(extractedFileName); ZipEntry ze; byte[] buffer = new byte[1024]; int nrBytesRead; if ((ze = zis.getNextEntry()) != null) { System.out.println(ze.getName()); while ((nrBytesRead = zis.read(buffer)) > 0) { os.write(buffer, 0, nrBytesRead); } } // close the streams os.close(); zis.close(); System.out.println("File Extracted successfully!!!"); } catch (IOException ex) { ex.printStackTrace(); } } public static void main(String[] args) { new xtractZipFile().extractZipFile(); } }