BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(propertyFile))));
Here I have tried giving propertyFile as both "/envsettings/xdev2/env.properties"
and "envsettings/xdev2/env.properties"
but still getting same file Not found issue.
When I see the directory structure I see C:\Users\primary\git\dev\SpringBoot\Originations\target\odyssey\WEB-INF\classes\config75\envsettings\dev2\env.properties
can anyone help please?
Never access the resources from the classpath like that. Use Class.getResourceAsStream
or ClassLoader.getResourceAsStream
:
BufferedReader br = new BufferedReader(
this.getClass().getResourceAsStream("path/relative/to/classpath/resource.file")
);