tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Ruthenbeck <just...@nextengine.com>
Subject Re: Setting Path for properties file
Date Wed, 21 Aug 2002 21:46:59 GMT

Jillian --

Instead of loading the properties from the file, you can load it 
dynamically as a system resource, then pass the InputStream into a new 
Properties object.  This way, you'll be able to load the properties file 
from anywhere in the classpath instead of just a hardcoded logical path in 
the filesystem.  For example:

this.getClass().loadResourceAsStream("/my.props");
Properties props = new Properties(inStream);

The properties file will be loaded by the ClassLoader associated with your 
webapp, so you'll have to put the props file in a directory that that 
ClassLoader can access.  I've never tried it, but I would think you could 
just place it in the WEB-INF/lib directory (can anyone confirm/refute?) 
directly.  If not, you could always jar it up and place it there.

justin


At 02:19 PM 8/21/2002, you wrote:
>I am using a properties file for my Java Beans/classes to reference
>directly.  I am having problems determining where I specify the path so that
>my classes can find the file in my application's directory. Right now the
>only way I can read the file is if I put it in my Tomcat\bin directory.  I
>would like to be able to put the file in my application's directory
>structure instead of into Tomcat's.  Is there a way to specify this?
>
>Jillian Reiman
>Phone:  612-667-8741
>jillian.reiman@wellsfargo.com
>
>--
>To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message