Here you can find the source of getResourcePath(Class> clazz, String fileName)
public static String getResourcePath(Class<?> clazz, String fileName)
//package com.java2s; //License from project: Apache License import java.net.URL; public class Main { public static String getResourcePath(Class<?> clazz, String fileName) { URL resource = clazz.getResource(fileName); return resource == null ? null : resource.getPath(); }//from w ww. java 2s. c o m }