Here you can find the source of getResource(final Class clazz, final String res)
private static URL getResource(final Class clazz, final String res)
//package com.java2s; import java.net.URL; public class Main { private static URL getResource(final Class clazz, final String res) { final URL url = clazz.getResource(res); if (url == null) { throw new RuntimeException("Resource '" + res + "' not found!"); } else {/*from w w w .j a v a 2 s . c om*/ return url; } } }