I am using the following code to extract zip files from jar file
source = "zip/test.zip"
destination = "c:\\"
public void unzip(String source,String destination){
try{
ZipInputStream in = new ZipInputStream( this.getClass().getResourceAsStream(source));
FileOutputStream fos = null;
ZipEntry ze = null;
File ff = null;
while ( (ze=in.getNextEntry() ) != null ){
System.out.println( "name=" + ze.getName() );
ff = new File( destination + ze.getName() );
if ( ze.isDirectory() ){
System.out.println("making "+ze.getName()+" dir ("+ ff.mkdirs() +")");
}
else{
fos = new FileOutputStream( ff );
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0){
fos.write(buf, 0, len);
}
fos.close();
System.out.println("wrote file "+ff.getPath()+" success=" + ff.exists() );
}
}
in.close();
}catch(Exception e){
e.printStackTrace();
}
}
But i found error in extracting zip file
java.io.FileNotFoundException: C:\eclipse\.eclipseproduct (The system cannot find the path specified)
I need some quick response on it.