?
Solved

This program to zip file not working. Where is the error.

Posted on 2012-08-13
4
Medium Priority
?
327 Views
Last Modified: 2012-08-13
I have the following code which does'nt zips the file. Where is the error, and can any1 rectify that.
I am running on command prompt.
Assuming that a.txt and b.txt exists in that folder.
TestZip.java
0
Comment
Question by:searchsanjaysharma
  • 2
  • 2
4 Comments
 
LVL 36

Expert Comment

by:mccarl
ID: 38290754
What error are you getting? It runs fine for me, zips the files correctly!
0
 

Author Comment

by:searchsanjaysharma
ID: 38290772
Error is attached.
error.docx
0
 
LVL 36

Accepted Solution

by:
mccarl earned 2000 total points
ID: 38290788
Ahh, yeah, you will need all the correct import statements. Replace the import that you have (at the top of your file) with this...

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

Open in new window

(Better to explicitly import each class, it's a good habit to get into that will help you when writing more complex programs)
0
 

Author Closing Comment

by:searchsanjaysharma
ID: 38290824
Good
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
The viewer will learn how to implement Singleton Design Pattern in Java.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question