【发布时间】:2012-03-10 01:55:32
【问题描述】:
我有一个 JAR 文件 Movie Library.jar,其内容如下所示:
PropertiesUtils 类位于client.jar 中(如图所示),属性文件位于resources 文件夹中的properties 文件夹中。
我正在尝试将属性加载为:
String absolutePath = LazyProperties.class.getClass().getResource(filePath).getPath();
File file = new File(absolutePath);
InputStream stream = new FileInputStream(file);
Properties properties = new Properties();
properties.load(stream);
但它正在显示:
file:\D:\Code\MovieLibrary\build\jar\Movie%20Library.jar!\resources\properties\movie_library.properties (The filename, directory name, or volume label syntax is incorrect)
我无法将其视为System.out.println(file) 打印:
file:/D:/Code/MovieLibrary/build/jar/Movie%20Library.jar!/resources/properties/movie_library.properties
任何帮助都是可观的。提前致谢。
【问题讨论】:
标签: java file properties io inputstream