Mike, I see your issue is solved. For the sake of the archives I feel
the need to respond to the suggestion of modifying the classpath.
Please DO NOT modify the classpath. Best practice is to work with the
existing classloader structure and put files in the proper places.
Modifying the class path environment variable is just asking for huge
problems. You do it and then forget or the next developer/sysadmin in
line doesn't know it and all sorts of quirky problems show up.
--David
Rashmi Rubdi wrote:
> Hi Mike,
>
> On 5/1/07, Mike Peremsky <mperemsky@yahoo.com> wrote:
>> What do I need to do to get the class in the jar file to find the
>> properties files external to it?
>
> To access a properties file that is external to the JAR file , add the
> full path of the Properties file's folder to the CLASSPATH.
>
> If you add the path of the Properties file to the CLASSPATH, there's
> no need to place the properties file under /WEB-INF/classes/ folder ,
> it can be located anywhere you want.
>
> After setting the CLASSPATH, the properties file can be accessed
> simply by specifying its name.
>
> For example:
>
> If the mypropertiesfile.properties is placed under
> C:/dev/mypropertiesfile.properties
>
> set CLASSPATH=%CLASSPATH%;C:/dev/
>
> public class TestPropertiesFile {
> public static void main(String[] args) {
> ResourceBundle props =
> ResourceBundle.getBundle("mypropertiesfile");
> //String planet = (String) props.getObject("planet");
> //System.out.println("Planet: " + planet);
> }
> }
>
>
>
>> TIA
>>
>> - Mike
>
> -Regards
> Rashmi
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
|