获取文件路径的问题

来源:互联网 发布:深圳资深淘宝客服 编辑:程序博客网 时间:2024/05/21 17:51

这里写图片描述

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 );    }}

(如有不正确,欢迎纠错)

原创粉丝点击