URL classPath = Thread.currentThread().getContextClassLoader().getResource("");
String proFilePath = classPath.toString();
//移除开通的file:/六个字符
proFilePath = proFilePath.substring(6) + "template/service_proposal.pptx";//proFilePath就是service_proposal.pptx 的路径
File file = new File(proFilePath);
Java代码获取classpath路径方法和资源文件路径方法
最新推荐文章于 2024-08-18 22:53:33 发布