pulbic class Test{
public static void main(String[] args){
URL url = Test.class.getResource(""); //结果:file:/e://xxx
String downloadPath = new File(url.toURI()).getAbsolutePath(); //结果:e://xxx
}
}
获取当前类的绝对路径,去掉file:/
最新推荐文章于 2022-10-14 10:23:11 发布
5072

被折叠的 条评论
为什么被折叠?



