Stephan van Hulst wrote:The properties file should always be in a fixed location relative to your WAR.
Shouldn't you use
ServletContext.getRealPath? That's the official way to get a path to something inside your WAR. You can then use Path to go up as far as you like. That can still be troublesome because the container might deploy the files to some temp folder.
WebLogic has an environment variable (
DOMAIN_HOME) that indicates where its domain home is, and that's what we use at work to determine a proper base location.
JBoss has some system variables that can be used in a similar way (e.g.
jboss.server.config.dir). These work on both Windows and Linux. Does GlassFish also have something like that?