• Post Reply Bookmark Topic Watch Topic
  • New Topic

Decompress a zip file in java  RSS feed

 
sarada bokka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have created a zip file with winzip and the zip contains

test
t1.txt
t2.txt

Now I am trying to unzip the file using the example Code Sample 1: UnZip.java provided in http://java.sun.com/developer/technicalArticles/Programming/compression/

but it throws the below error

Extracting: test/
Extracting: test/t1.txt
java.io.FileNotFoundException: test\t1.txt (The system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
at UnZip.main(UnZip.java:33)

I am trying to run the sample code in eclipse.

Any help will be much appreciated.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the directory named "test" exist? If not, then you need to create it first before trying to write to a file "t1.txt" that should go into that directory.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!