Here you can find the source of getResource(Class> c, String name)
public static String getResource(Class<?> c, String name)
//package com.java2s; import java.net.URISyntaxException; public class Main { public static String getResource(Class<?> c, String name) { try {/*from w ww .j a v a 2s . c o m*/ return c.getResource(name).toURI().toString(); } catch (URISyntaxException e) { throw new RuntimeException(e); } } }