Here you can find the source of getPath(final String aPath, final Class> aClass)
public static String getPath(final String aPath, final Class<?> aClass) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; public class Main { public static final String CLASSPATH_PREFIX = "classpath:"; public static String getPath(final String aPath, final Class<?> aClass) throws IOException { final URL url = getClasspathUrl(aClass, aPath); return url != null ? url.toString() : aPath; }//from ww w. j a va 2s . c o m public static URL getClasspathUrl(final Class<?> aClass, final String aPath) throws IOException { if (aPath != null && aPath.startsWith(CLASSPATH_PREFIX)) { return getResourceUrl(aClass, aPath.substring(CLASSPATH_PREFIX.length())); } else { return null; } } public static URL getResourceUrl(final Class<?> aClass, final String aPath) throws IOException { final URL url = aClass.getResource(aPath); if (url == null) { throw new FileNotFoundException("Resource not found for " + aClass.toString() + ": " + aPath); } else { return url; } } }