JAVA类中获取项目路径

在java web项目中获取项目的src/main/resource下的文件路径java

当前类名.class.getClassLoader().getResource("/").getPath();

  好比个人当前类名叫Demoweb

那么:blog

Demo.class.getClassLoader().getResource("/").getPath();
相关文章
相关标签/搜索