清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
import java.net.URL; import org.apache.commons.lang.StringUtils; /** * 类路径获取 */ public class ResourcePathTester { public static void main(String[] args) { System.out.println(getResourcePath()); } private static String getResourcePath() { String className = ResourcePathTester.class.getName(); String classNamePath = className.replace(".", "/") + ".class"; URL is = ResourcePathTester.class.getClassLoader().getResource(classNamePath); String path = is.getFile(); path = StringUtils.replace(path, "%20", " "); return StringUtils.removeStart(path, "/"); } }