You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ricardo Rocha <ri...@apache.org> on 2000/05/11 11:55:31 UTC

Re: OT question on getResource()

> From one package, how can I get a resource from another package?
> E.g., if I'm in org.apache.cocoon and I want the resource
> cocoon.properties, I just do this: 
>    getClass().getResource("cocoon.properties")
> but suppose I want, uh, org.apache.xalan.xalan.properties. this doesn't
> work:
>    getClass().getResource("org.apache.xalan.xalan.properties")
> nor does this
>getClass().getClassLoader().getSystemResource("org.apache.xalan.xalan.properties")

Have you tried:

getClass().getClassLoader().getSystemResource("/org/apache/xalan/xalan/properties")


Re: OT question on getResource()

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 11 May 2000, Niclas Hedhman wrote:

> Ricardo Rocha wrote:
> 
> > Have you tried:
> >
> > getClass().getClassLoader().getSystemResource("/org/apache/xalan/xalan/properties")
> 
> getClass().getClassLoader().getSystemResource("/org/apache/xalan/xalan.properties")
> 
> Could be a matter of wrong classloader being asked, if you are in Java2.
> If so, try;
> 
> Thread.currentThread().getContextClassLoader().getSystemResource......

None of these worked, actually.

- donald


Re: OT question on getResource()

Posted by Niclas Hedhman <ni...@localbar.com>.
Ricardo Rocha wrote:

> Have you tried:
>
> getClass().getClassLoader().getSystemResource("/org/apache/xalan/xalan/properties")

getClass().getClassLoader().getSystemResource("/org/apache/xalan/xalan.properties")

Could be a matter of wrong classloader being asked, if you are in Java2.
If so, try;

Thread.currentThread().getContextClassLoader().getSystemResource......

Niclas