Re: How to load properties as resources?
- From: "Mr. Land" <graftonfot@xxxxxxxxx>
- Date: 31 Jan 2006 07:58:28 -0800
> I'd do it more directly with:
> InputStream fis = MyApp.class.getResourceAsStream( "Common.properties" );
I did start with something similar:
InputStream is =
SystemProperties.class.getClassLoader().getResourceAsStream("Common.properties");
....but this was throwing a NPE since getClassLoader() returns null in
this case.
I also tried:
InputStream is =
SystemProperties.class.getResourceAsStream("Common.properties");
....which gave me a null result.
> 1. unsigned Applets are not permitted to tinker with Classloaders
Sorry, I should have made specific: this is not an Applet, it's a Java
application with a main().
> 2. the classloader for java.lang.SystemProperties is not necessarily
> the same one used for finding your App and its resources.
Ahh, yes, and this feels like the crux of my question: How can I get
the class loader returned from:
ClassLoader.getSystemClassLoader();
....to find my resources? No path that I can think of seems to work.
Thanks again.
.
- Follow-Ups:
- References:
- How to load properties as resources?
- From: Mr. Land
- Re: How to load properties as resources?
- From: Roedy Green
- How to load properties as resources?
- Prev by Date: Re: passing and testing for a query string
- Next by Date: Limit Single Instance
- Previous by thread: Re: How to load properties as resources?
- Next by thread: Re: How to load properties as resources?
- Index(es):