I need to read an
I have chalked out a solution for myself reading the following similar posts and articles.
I have defined a Environment inside my Context for my web application under \conf\Catalina\localhost\mywebapp.xml as follows....
<Environment name="propertiesfilelocation" value="E:\\tmp\\application.properties" type="java.lang.String" override="false"/>
Then accessed my properties file using a JNDI lookup to get the file name.
Context ctx = new InitialContext(); Context envCtx = (Context)ctx.lookup("java:comp/env"); String propertiesFileLocation = (String) envCtx.lookup("propertiesfilelocation"); LOGGER.info("String property === " + propertiesFileLocation); properties.load(new FileInputStream(propertiesFileLocation));
@home : Yes you are right it involved FileInputStream. However, I am happy with the solution because I am no longer hard coding my folder location inside my Java code which makes my app more portable.