@、使用toURI()方法

String rootPath = this.getClass().getClassLoader().getResource(".").toURI().getPath();

原文:https://www.cnblogs.com/tv151579/p/6220443.html

@、使用URLDecoder.decode方法

String rootPath = this.getClass().getClassLoader().getResource(".").getPath();

这中方式获取到的路径,其中的空格被转换成%20,可通过rootPath = URLDecoder.decode(rootPath ,"utf-8");进行转换。

原文:https://blog.csdn.net/aa__aa1122/article/details/50409342

 

相关文章:

  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-06-10
  • 2021-12-24
  • 2021-08-22
  • 2021-08-29
  • 2022-12-23
猜你喜欢
  • 2022-01-06
  • 2021-12-07
  • 2022-02-13
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案