GetMainAttr

try {
    // Open the JAR file
    JarFile jarfile = new JarFile("filename.jar");

    // Get the manifest
    Manifest manifest = jarfile.getManifest();

    // Get the main attributes in the manifest
    Attributes attrs = (Attributes)manifest.getMainAttributes();

    // Enumerate each attribute
    for (Iterator it=attrs.keySet().iterator(); it.hasNext(); ) {
        // Get attribute name
        Attributes.Name attrName = (Attributes.Name)it.next();

        // Get attribute value
        String attrValue = attrs.getValue(attrName);
    }
} catch (IOException e) {
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.