I have a JAR file Movie Library.jar, its contents are depicted below:
The class PropertiesUtils is resides in the client.jar (shown in picture) and the properties files are in properties folder which resides in resources folder.
I am trying to load properties as:
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);
But it is showing:
file:D:CodeMovieLibraryuildjarMovie%20Library.jar!
esourcespropertiesmovie_library.properties (The filename, directory name, or volume label syntax is incorrect)
I am unable to figure it as System.out.println(file)
prints:
file:/D:/Code/MovieLibrary/build/jar/Movie%20Library.jar!/resources/properties/movie_library.properties
Any help is appreciable. Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…