Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How to create a zip file in java

  Asked By: Dale    Date: Feb 08    Category: Java    Views: 954
  

Pls guide me with code if possible, how do I create zip file which contains
some specified files thro java.?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Umaiza Hashmi     Answered On: Feb 08

Try something like this:

String command = "zip file.zip file1 file2";
// the zip  syntax might be wrong...
Process p = Runtime.getRuntime().exec(command);

You can create  nicer sequences (with threads and all), but this should give
you an idea where to start...

 
Answer #2    Answered By: Barachias Levi     Answered On: Feb 08

or you can user the built-in java  zipping tool. go to
developer.java.sun.com/.../
compression/#code2 for a full guide

 
Didn't find what you were looking for? Find more on How to create a zip file in java Or get search suggestion and latest updates.




Tagged: