Java IO Tutorial - Java JarFile.getJarEntry(String name)








Syntax

JarFile.getJarEntry(String name) has the following syntax.

public JarEntry getJarEntry(String name)

Example

In the following code shows how to use JarFile.getJarEntry(String name) method.

// www  . j  a v  a  2s.  co  m
import java.io.File;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

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

    JarEntry entry = jarfile.getJarEntry("fileName");

  }
}