import java.io.BufferedInputStream; import java.io.FileInputStream; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarInputStream; public class TomcatSlowTest { public static void main(String[] args) throws Exception { { long t0 = System.currentTimeMillis(); JarFile jarFile = new JarFile(args[0]); jarFile.getEntry("NotExistent"); long t1 = System.currentTimeMillis(); System.out.println("Time elapsed with JarFile (Tomcat 7.0.12): " + (t1 - t0) + " ms"); } { long t0 = System.currentTimeMillis(); JarInputStream jarInputStream = new JarInputStream(new BufferedInputStream(new FileInputStream(args[0]))); JarEntry entry; while ((entry = jarInputStream.getNextJarEntry()) != null) if (entry.getName().equals("NotExistent")) break; long t1 = System.currentTimeMillis(); System.out.println("Time elapsed with JarInputStream (Tomcat 7.0.14): " + (t1 - t0) + " ms"); } } }