Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error while extracting zip file

807606Apr 5 2007 — edited Apr 5 2007
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2007
Added on Apr 5 2007
4 comments
633 views