The moose likes Tomcat and the fly likes Properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "Properties file" Watch "Properties file" New topic
Author

Properties file

Ritu Kama
Ranch Hand

Joined: Sep 10, 2001
Posts: 72
Where should I place a .properties file in tomcat environment?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 11863
That depends on how you plan to read it. If you place it under the WEB-INF directory of your application, you can read it via the servlet context like this:

but because it is under WEB-INF, it can't be served by the web server.
An alternative would be to put it in a directory elsewhere and pass the path to the servlet as an init param in web.xml.
Bill
Bill


Java Resources at www.wbrogden.com
 
 
subject: Properties file
 
Threads others viewed
Common resource for all configurable parameters.
JAD File size
Replace words in a file by reading a properties file
How not to hard-code file location in java?
can the state of a checkbox be saved
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture