public static URL[] findResourceBases(String baseResource,ClassLoader loader){
  ArrayList<URL> list=new ArrayList<URL>();
  try {
    Enumeration<URL> urls=loader.getResources(baseResource);
    while (urls.hasMoreElements()) {
      URL url=urls.nextElement();
      list.add(findResourceBase(url,baseResource));
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return list.toArray(new URL[list.size()]);
}

public static URL [ ] findResourceBases ( String baseResource , ClassLoader loader ) { ArrayList < URL > list = new ArrayList < URL > ( ) ; try { Enumeration < URL > urls = loader . getResources ( baseResource ) ; while ( urls . hasMoreElements ( ) ) { URL url = urls . nextElement ( ) ; list . add ( findResourceBase ( url , baseResource ) ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return list . toArray ( new URL [ list . size ( ) ] ) ; }
find the classpath urls for a specific classpath resource . the classpath url is extracted from loader . getresources ( ) using the baseresource .
