Manifest: getMainAttributes() : Manifest « java.util.jar « Java by API






Manifest: getMainAttributes()

 

import java.util.Iterator;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;

public class Main {
  public static void main(String[] argv) throws Exception {
    JarFile jarfile = new JarFile("filename.jar");

    Manifest manifest = jarfile.getManifest();

    Attributes attrs = (Attributes) manifest.getMainAttributes();

    for (Iterator it = attrs.keySet().iterator(); it.hasNext();) {
      Attributes.Name attrName = (Attributes.Name) it.next();

      String attrValue = attrs.getValue(attrName);
    }
  }
}

   
  








Related examples in the same category

1.new Manifest(InputStream is)
2.Manifest: getEntries()