Here you can find the source of getPathOfResource(Class> clazz, String fileName)
public static String getPathOfResource(Class<?> clazz, String fileName)
//package com.java2s; //License from project: Open Source License import java.net.URL; public class Main { public static String getPathOfResource(Class<?> clazz, String fileName) { URL url = getUrlAsResource(clazz, fileName); if (url == null) return null; return url.getPath(); }//from ww w . j a va2 s .c o m public static URL getUrlAsResource(Class<?> clazz, String fileName) { URL url = clazz.getResource(fileName); return url; } }