> From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> Sent: Wednesday, February 26, 2003 11:37 AM
> Subject: RE: Properties file [SOLVED?]
> > From: Jos� Moreira <[EMAIL PROTECTED]>
> > String path =
> >
this.getClass().getClassLoader().getResource("config.properties").getPath().
> > toString();
> >
> > FileInputStream in = new FileInputStream(path);
> You are working too hard. :-)
> InputStream is = getClass().getResourceAsStream("config.properties");
Now, as a nit, it would seem to me that not only is he working too hard, but
what he is doing may not even work. The assumption is that getResource will
return a URL to which the getPath part actually points to a File. That's not
guaranteed at all, I don't believe, particularly if the resource is buried
in a JAR.
I imagine that the better way to "work too hard" here would be "simply":
InputStream in =
this.getClass().getClassLoader().getResource("config.properties").openStream
()
Regards,
Will Hartung
([EMAIL PROTECTED])
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]