Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Where should I put properties files (corrected, sorry)

Michael D. Spence

2003-09-18


I have a web service (call it XYZ) which requires a .properties file. I had
been putting it in
%CATALINA_HOME%\webapps\axis\services\XYZ, with the classes in
%CATALINA_HOME%\webapps\axis\services\WEB_INF\classes and using this to
open the properties file.

  File PFile = new File("webapps" + File.separator +
                "axis" + File.separator +
                "services" + File.separator +
                "XYZ" + File.separator + "XYZ.properties");

  if (!PFile.exists())
   throw new CFException("No properties file: " +
PFile.getAbsolutePath());

This works, but there are two problems:

1) If Tomcat is run as a service, I have to put the properties file in
%WINSYSDIR%\webapps\axis\services\XYZ, instead.

2) I recently ditched the classes and put XYZ.jar into
%CATALINA_HOME%\webapps\axis\services\WEB_INF\lib. Now, unless I hard-code
a path for the properties file (e.g., C:\XYZ.properties), the service can't
find it.

How is this issue normally handled?

Michael D. Spence
Mockingbird Data Systems, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.