This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • 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: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at this example
 
Do not threaten THIS beaver! Not even with this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!