Here you can find the source of getAbsoluteResource(String path)
public static URL getAbsoluteResource(String path)
//package com.java2s; //License from project: Apache License import java.net.URL; public class Main { private static ClassLoader[] theClassLoaders; public static URL getAbsoluteResource(String path) { return _getAbsoluteResource(path, true); }/* ww w .j ava2 s . c om*/ private static URL _getAbsoluteResource(String path, boolean recursive) { URL url = null; for (ClassLoader classLoader : theClassLoaders) { url = classLoader.getResource(path); if (url != null) { break; } } if (url == null && recursive) { if (path.startsWith("/")) { path = path.substring(1); } else { path = "/" + path; } url = _getAbsoluteResource(path, false); } return url; } }