• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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

 
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.
 
Bartender
Posts: 9620
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at this example
 
reply
    Bookmark Topic Watch Topic
  • New Topic