Here you can find the source of getPath(final String fileName)
public static String getPath(final String fileName)
//package com.java2s; //License from project: Apache License import java.net.URL; public class Main { public static final String CLASSPATH = System.getProperty("java.class.path"); public static String getPath(final String fileName) { final URL url = ClassLoader.getSystemResource(fileName); if (url != null) { return url.getFile(); } else {/*from w w w. j a v a2 s . c o m*/ throw new IllegalArgumentException( "File " + fileName + " does not exist on the classpath: " + CLASSPATH); } } }