File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to extract jar files into a folder using java code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to extract jar files into a folder using java code?" Watch "How to extract jar files into a folder using java code?" New topic
Author

How to extract jar files into a folder using java code?

anitha nair
Greenhorn

Joined: Jul 12, 2006
Posts: 12
Hai forum,

I have to extract the class files of a dynamically selected jar file into a folder in local disk as well as display the class files in a combo box.I could display the class files in a combo box ,but iam having no idea as to how it should be saved into a folder.

My code is given here,

JarFile jarFile = new JarFile(path);
Enumeration entries = jarFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
if(entry.getName().endsWith(".class"))
jComboBox1.addItem(entry.getName());

//HERE I WANT TO TRANSFER THESE CLASS FILES INTO A FOLDER
} jarFile.close();


Please help,
Thank you.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8877
    
    8

Have a look at this example


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
jQuery in Action, 2nd edition
 
subject: How to extract jar files into a folder using java code?