resources文件夹中所有文件的路径如何完整地表达出来?
- 内容介绍
- 文章标签
- 相关推荐
本文共计70个文字,预计阅读时间需要1分钟。
plaintext获取系统配置文件路径的两种方法:
1.使用Object的类加载器:
String path=Object.class.getClassLoader().getResource(system_name.json).getPath();2.使用当前线程的类加载器:
String path=Thread.currentThread().getContextClassLoader().getResource(system_name.json).getPath(); gistfile1.txtString path = Object.class.getClassLoader().getResource("system_name.json").getPath(); gistfile2.txt
String path = Thread.currentThread().getContextClassLoader().getResource("system_name.json").getPath();
本文共计70个文字,预计阅读时间需要1分钟。
plaintext获取系统配置文件路径的两种方法:
1.使用Object的类加载器:
String path=Object.class.getClassLoader().getResource(system_name.json).getPath();2.使用当前线程的类加载器:
String path=Thread.currentThread().getContextClassLoader().getResource(system_name.json).getPath(); gistfile1.txtString path = Object.class.getClassLoader().getResource("system_name.json").getPath(); gistfile2.txt
String path = Thread.currentThread().getContextClassLoader().getResource("system_name.json").getPath();

