Get the entry name for JarURLConnection in Java
Description
The following code shows how to get the entry name for JarURLConnection.
Example
/*from w w w . ja v a 2 s .c o m*/
import java.net.JarURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] argv) throws Exception {
URL url = new URL("jar:file:/c://my.jar!/");
JarURLConnection conn = (JarURLConnection) url.openConnection();
String entryName = conn.getEntryName();
System.out.println(entryName);
}
}
The code above generates the following result.