Java JarFile(String name, boolean verify) Constructor

Syntax

JarFile(String name, boolean verify) constructor from JarFile has the following syntax.

public JarFile(String name,  boolean verify)  throws IOException

Example

In the following code shows how to use JarFile.JarFile(String name, boolean verify) constructor.


/*  www.  j a  v a2s. com*/
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", true);

    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);
    }
  }
}




















Home »
  Java Tutorial »
    java.util.jar »




JarFile
Pack200