Here you can find the source of getResource(String name)
public static InputStream getResource(String name)
//package com.java2s; //License from project: Apache License import java.io.InputStream; public class Main { public static InputStream getResource(String name) { ClassLoader classloader = Thread.currentThread() .getContextClassLoader(); InputStream is = classloader.getResourceAsStream(name); return is; }//from ww w.j a v a 2 s .co m }