Here you can find the source of getFile(Object obj, String filename)
public static File getFile(Object obj, String filename)
//package com.java2s; //License from project: Apache License import java.io.File; import java.net.URL; public class Main { public static File getFile(Object obj, String filename) { String file = obj.getClass().getPackage().getName().replace('.', '/') + '/' + filename; URL url = obj.getClass().getClassLoader().getResource(file); return new File(url.getFile()); }/* www . j a v a2s . c o m*/ }