David,
If you place your properties files in WEB-INF/classes , then they are
guaranteed to be on the class loading path for the web application.
I use the following code in my webapps:
Properties p = new Properties();
Files.loadConfigFile("/database.properties", p);
And in my 'Files' class, the loadConfigFile method looks something like:
public static Properties loadConfigFile(String fileName, Properties def)
{
Properties props = new Properties();
try {
logger.debug("USING Files.class.getResourceAsStream(" + fileName
+ ")");
InputStream input = Files.class.getResourceAsStream(fileName);
if (input != null) {
try {
props.load(input);
} catch (Exception e) {
} finally {
try {
input.close();
} catch (Exception e) {
//well, we played nice.
}
}
}
return props;
}
> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of David LAFAY
> Sent: Thursday, September 11, 2003 3:30 AM
> To: [EMAIL PROTECTED]
> Subject: Re: ClassPath with Tomcat 4.1
>
>
> Thanks but...
>
> When the following code :
> System.getProperty("java.class.path")
>
> return only C:\Program Files\Apache Group\Tomcat
> 4.1.27\bin\bootstrap.jar
>
> It is a problem for me because I use the java.class.path to
> search my properties files
>
> And then I don't find it !
>
>
> "Kwok Peng Tuck" <[EMAIL PROTECTED]> a �crit dans le
> message news: [EMAIL PROTECTED]
> > Classes for your webapp are looked for in either :
> WEB-INF/lib; as a
> > jar file or WEB-INF/classes; non jar files So for example
> if you have
> > a jar file that you want to use in your web app, put them in your
> > webapp's WEB-INF/lib. You should be able to use them.
> >
> > David LAFAY wrote:
> >
> > >Hello,
> > >
> > >Tomcat 3.x have a wrapper.properties file.
> > >Where is it on tomcat 4.1.x release.
> > >
> > >I don't know how to configure classpath for my webApp
> > >
> > >Thanks,
> > >
> > >David
> > >[EMAIL PROTECTED]
> > >
> > >
> > >
> > >
> >
> >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail:
> [EMAIL PROTECTED]
> > >
> > >
> > >
> > >
> > >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]