ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen McConnell" <mcconn...@dpml.net>
Subject RE: Loading resources from my task's JAR?
Date Thu, 05 Jan 2006 09:25:58 GMT
 

> -----Original Message-----
> From: Steve Loughran [mailto:stevel@apache.org] 
> Sent: Thursday, 5 January 2006 7:34 PM
> To: Ant Users List
> Subject: Re: Loading resources from my task's JAR?
> 
> Rick Mann wrote:
> > I wrote an Ant task that needs to load some files (it's a source 
> > generator that loads template files). I'd like to store 
> those files  
> > in the task's .jar file, but so far I've met with no success. I've  
> > tried storing the files in various parts of the .jar:
> > 
> > templates/Class.tmpl
> > com/mycompany/tools/dbgen/Class.tmpl
> > Class.tmpl
> > 
> > and I've tried getting at it with (and more) from within my 
> task's code:
> > 
> > getClass().getResourceAsStream("templates/Class.tmpl")
> 
> this should work. 

Given that the "templates/Class.tmpl" is a relative address (relative to the
package namespace of the class returned from getClass()), and if the class
is in the package namespece "com/mycompany/tools/dbgen" then woudn't the
absolute resource reference would be
"/com/mycompany/tools/dbgen/templates.Class.tmpl" ?

/Steve.



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


Mime
View raw message