Exemple #1
0
 void expand(File jar, File dir) throws IOException {
   JarFile jarFile = new JarFile(jar);
   try {
     Enumeration<JarEntry> entries = jarFile.entries();
     while (entries.hasMoreElements()) {
       JarEntry je = entries.nextElement();
       if (!je.isDirectory()) {
         copy(jarFile.getInputStream(je), new File(dir, je.getName()));
       }
     }
   } finally {
     jarFile.close();
   }
 }
Exemple #2
0
 private static Hashtable<String, String> getManifestAttributes(File jarFile) {
   Hashtable<String, String> h = new Hashtable<String, String>();
   JarFile jar = null;
   try {
     jar = new JarFile(jarFile);
     Manifest manifest = jar.getManifest();
     h = getManifestAttributes(manifest);
   } catch (Exception ex) {
   }
   if (jar != null) {
     try {
       jar.close();
     } catch (Exception ignore) {
     }
   }
   return h;
 }