Sorry...solved it. Did this...
static public String formFullPath( String fName )
{
URL url;
if (fName.charAt(0) == '/'){
System.out.println("fName is " + fName);
return fName;
}
//url = ClassLoader.getSystemResource(fName);
ClassLoader cl = ClassLoader.getSystemClassLoader();
url = cl.getResource(fName);
System.out.println("url is " + url);
return (url == null) ? fName : url.getFile();
}
-----Original Message-----
From: Christopher K. St. John [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 11:00 AM
To: Tomcat Users List
Subject: Re: Loading property files using
ClassLoader.getSystemResource()
Bryan Austad wrote:
>
> I use a class with static methods to load properties. getResource() does
> not return a static URL, so I cannot use it within my static method.
> getSystemResource() returns a static URL.
>
static URL?
Do you mean that getSystemResource() is a static method in
ClassLoader? That's true, but you're allowed to call non-static
methods on other objects inside a static method. In fact,
getSystemResource() just gets the system classloader with
getSystemClassLoader() and calls getResource() on it.
Where are you calling the static methods from? From the init()
of a servlet? If so, you can get the servlet's classloader and
pass it to the static method.
--
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>