ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Walter.Heesterm...@toyota-europe.com
Subject Re: Problem loading properties file using the CLASSPATH
Date Wed, 07 Apr 2004 12:51:33 GMT

I replace my code by getClass().getClassLoader().getResourceAsStream(...)
and It works fine now in ANT 1.6.1

Walter



                                                                                         
                         
                                                                                         
                         
                                            To:  user@ant.apache.org                     
                         
                                            cc:                                          
                         
                                            bcc:                                         
                         
                                            Subject:  Re: Problem loading properties file
using the CLASSPATH      
            Stefan Bodewig                                                               
                         
            <bodewig@apache.org>                                                   
                               
            07/04/2004 14:23                                                             
                         
                                                                                         
                         
                                                                                         
                         




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






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


Mime
View raw message