• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
anitha nair
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9314
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at this example
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic