JarFile(String name) constructor from JarFile has the following syntax.
public JarFile(String name) throws IOException
In the following code shows how to use JarFile.JarFile(String name) constructor.
import java.io.IOException; import java.util.Enumeration; import java.util.jar.JarEntry; import java.util.jar.JarFile; /* w ww. ja v a 2 s . c om*/ public class Main { public static void main(String args[]) throws IOException { JarFile jarFile = new JarFile("c:/abc/yourJarFileName.jar"); Enumeration<JarEntry> e = jarFile.entries(); while (e.hasMoreElements()) { process(e.nextElement()); } jarFile.close(); } private static void process(Object obj) { JarEntry entry = (JarEntry) obj; String name = entry.getName(); long size = entry.getSize(); long compressedSize = entry.getCompressedSize(); System.out.println(name + "\t" + size + "\t" + compressedSize); } }