Here you can find the source of getJarPath(String pkg)
public static URL getJarPath(String pkg)
//package com.java2s; //License from project: Apache License import java.net.URL; import java.util.Enumeration; public class Main { public static URL getJarPath(String pkg) { try {//from w w w . j a v a 2s.com Enumeration<URL> resources = Thread.currentThread().getContextClassLoader() .getResources(pkg.replace('.', '/')); while (resources.hasMoreElements()) { URL url = (URL) resources.nextElement(); return url; } return null; } catch (Exception e) { throw (e instanceof RuntimeException) ? (RuntimeException) e : new RuntimeException(e); } } }