62,614
社区成员
发帖
与我相关
我的任务
分享
package mytest;
import java.net.URL;
import java.util.Enumeration;
public class TestGetResources {
public static void main(String[] args) throws Exception {
Enumeration<URL> urls= getClassLoader().getResources("/config1/1.xml");
while (urls.hasMoreElements()){
URL url=urls.nextElement();
System.out.println(url.getFile());
}
}
private static ClassLoader getClassLoader() throws Exception{
// return TestGetResources.class.getClassLoader();
return Thread.currentThread().getContextClassLoader();
}
}