Here you can find the source of getResources(String path, ClassLoader loader)
protected static Enumeration<URL> getResources(String path, ClassLoader loader) throws IOException
//package com.java2s; import java.io.*; import java.net.URL; import java.util.*; public class Main { protected static Enumeration<URL> getResources(String path, ClassLoader loader) throws IOException { // make sure the class loader isn't null if (loader == null) { // log.debug("No loader for get resource request", "path", path); return null; }//from w w w. jav a2s.co m // try the path as is Enumeration<URL> enm = loader.getResources(path); if (enm.hasMoreElements()) { return enm; } // try toggling the leading slash return loader.getResources(togglePath(path)); } protected static String togglePath(String path) { if (path.startsWith("/")) { return path.substring(1); } else { return "/" + path; } } }