I am trying to load a properties file from a
class that is in a jar file that is in the $TOMCAT_HOME/lib directory.
The properties file itself is not in the jar. It is
in $TOMCAT_HOME/properties, which is
in tomcat's classpath because I added it in
the startup script (I verified that it is listed
in the path at startup).
If I use FileInputStream it works, but only
if I use the full file path. I obviously would
not like to have to do this.
But if I do the following:
Properties props = new Properties();
try
{
InputStream is = this.getClass().getResourceAsStream("DB.properties");
if (is == null)
throw new Exception("Properties file not found");
props.load(is);
}
....
It doesn't work (the exception gets thrown).
Any suggestions on a way to do this that works?
Thanks,
Mark