Here you can find the source of getClasspathFile(String fn)
public static File getClasspathFile(String fn)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.net.URISyntaxException; public class Main { public static File getClasspathFile(String fn) { File f = null;//from ww w . j av a 2 s. com try { f = new File(Thread.currentThread().getContextClassLoader().getResource(fn).toURI()); } catch (URISyntaxException e) { e.printStackTrace(); } return f; } }