ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Problem loading properties file using the CLASSPATH
Date Wed, 07 Apr 2004 12:23:41 GMT
On Wed, 7 Apr 2004, Walter Heestermans
<Walter.Heestermans@toyota-europe.com> wrote:

> InputStream in =
> ClassLoader.getSystemClassLoader().getResourceAsStream
> ("TheProperties.properties");
> 
> The location of the properties file is searched using the CLASSPATH.
> 
> This works fine in ANT version 1.5.4, but not anymore in ANT version
> 1.6.1.  Probably related to the new classloader implementation. How
> can I solve this issue?

Where exactly is your resource?  Inside a jar that lives in
ANT_HOME/lib, I assume.

The content of ANT_HOME/lib has been on the system CLASSPATH in Ant
1.5.x but no longer is in Ant 1.6.x.

Use getClass().getClassLoader().getResourceAsStream(...)
instead, this will look up the resource in the same classloader that
has loaded your class.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message