It's not a secret anymore!*
The moose likes Servlets and the fly likes reading a properties file from the war file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "reading a properties file from the war file" Watch "reading a properties file from the war file" New topic
Author

reading a properties file from the war file

mat buckland
Greenhorn

Joined: Sep 01, 2009
Posts: 24
I have a properties file located in the root of the war file.

How do I read in that properties file when the servet is deployed?

thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
That's what ServletContext.getResourceAsStream is for.

You may want to move the file from the web app root into the WEB-INF directory, though, lest it becomes publicly accessible.


Ping & DNS - my free Android networking tools app
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: reading a properties file from the war file
 
Similar Threads
best place to put configuration properties.
cannot load property file from WAR
Access deployed archive contents
Internatonalization in Liferay
Don't see properties files after deployment from Jdeveloper 11g