InputStream in = PropertiesUtils.class.getClassLoader().getResourceAsStream(fileName);
prop.load(in);
prop.setProperty(propertyName, propertyVlaue);
String url = PropertiesUtils.class.getClassLoader().getResource(fileName).toString().substring(6);
File file = new File(url);
substring(6)的作用是去掉取得路径的/file:
版权声明:本文为CSDN博主「weixin_33800593」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_33800593/article/details/91728717