tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Stör <mar...@frightanic.com>
Subject Re: properties file confusion
Date Thu, 10 Apr 2003 08:45:14 GMT
Steven Shand wrote:
>>> local system account as the user, and the system32 directory is the
>>> default directory for the service.
>>
>> Oh yeah, that makes sense. Thanks.
>>
>>> You'd be better off putting the location of your properties file in
>>> your web.xml:
>>>     <init-param>
>>>       <param-name>properties</param-name>
>>>       <param-value>C:/myData/my.properties</param-value>
>>>     </init-param>
>>> and reading it from there using
>>> servletConfig.getInitParameter("properties").
>>
>> My class is not a servlet. What would I do it if it is used by a
>> regular desktop app? So, servletConfig is not an option.
>
> you could also just make sure that the properties file lives somewhere
> on the classpath and use:
>
> Properties properties = new Properties();
> InputStream inputStream = getClass().getResourceAsStream( "/" +
> "my.properties" );
> properties.load( inputStream );

Oh, I've tried this before - but without the leading "/". Works just fine if
I place the properties file in WEB-INF\classes.

Marcel


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


Mime
View raw message