Howdy,
This is a FAQ, you could read the archives, but here's a summary of the
two commons solutions:

- Place properties file on classpath, use the Class#getResource or
Class#getResourceAsStream method.

- Please properties file anywhere under your webapp's root, and use
ServletContext#getResource or ServletContext#getResourceAsStream.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Michael D. Spence [mailto:[EMAIL PROTECTED]
>Sent: Thursday, September 18, 2003 10:57 AM
>To: [EMAIL PROTECTED]
>Subject: Where should I put properties files
>
>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
>%CATALINA_HOME%\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: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to