Here you can find the source of getURL(String path)
public static URL getURL(String path)
//package com.java2s; import java.net.*; public class Main { public static URL getURL(String path) { class ClassOnCurrentClassLoader { }//from w ww .j av a2s . c om ; Object c = new ClassOnCurrentClassLoader(); return c.getClass().getResource(path); // it looks relative to the class. // return c.getClass().getClassLoader().getResource(path); // it looks in the top level directories of your class path. } }