0

I have added the Jar as a dependency in our web applications. The Jar contains the functionality, which calls the main method of a class with string arguments. When we are using this through our web application, the properties file is not getting loaded which is present in the jar, due to which we are getting the error in the log, file not found(./appconfig.properties) while hitting our web application.

InputStream fileInputStream = ClassLoader.class.getResourceAsStream("./appconfig.properties");
Properties props = new Properties();
if (fileInputStream != null) 
 props.load(fileInputStream);
  • possible duplicate [load-properties-file-in-jar](https://stackoverflow.com/questions/2815404/load-properties-file-in-jar) – bugsb Aug 19 '19 at 10:13
  • 2
    Why `ClassLoader.class.getResourceAsStream`? That will load from the boot classpath only. Can you change it to `SomeClassInTheSameJarAsTheProps.class.getResourceAsStream`? – Thilo Aug 19 '19 at 10:19

0 Answers0