public class test {
public static void main(String[] args) throws URISyntaxException {
//获取到的是资源文件的根路径
URL url3 = test.class.getClassLoader().getResource("");
String path4 = test.class.getClassLoader().getResource("").getPath();
//获取到的是资源文件的根路径
System.out.println("url3:"+url3);
System.out.println("path4 :"+path4 );
}
}
(如有不正确,欢迎纠错)