|
Hi Deon, You may find several locations that work, depending on your container, but the recommendation for Struts is in a directory beneath WEB-INF/classes. That ensures the resource is accessible from the classpath. It should work for any web app and gives a consistent way to locate resources. To access resources, the most flexible method is: InputStream is = Thread.currentThread(). getContextClassLoader(). getResourceAsStream("/props/myprops.properties"); The ContextClassLoader business has to do with the possibility of hot swapping, in which case different class loaders may be used for different versions of the same class. Joe Sam Joe Sam Shirah - http://www.conceptgo.com conceptGO - Consulting/Development/Outsourcing Java Filter Forum: http://www.ibm.com/developerworks/java/ Just the JDBC FAQs: http://www.jguru.com/faq/JDBC Going International? http://www.jguru.com/faq/I18N Que Java400? http://www.jguru.com/faq/Java400 ----- Original Message ----- From: <DReid@xxxxxxxxxxxxxxxxxx> To: <java400-l@xxxxxxxxxxxx> Sent: Wednesday, March 16, 2005 11:31 AM Subject: Properties file in WAR Hi everyone, I have packaged my web application into a war file. Where do I put my application properties file and how do I access it. I am currently getting the following message: java.io.FileNotFoundException: mfproperties.properties (The system cannot find the file specified). Any help would be appreciated. Deon
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.