> -----Original Message----- > From: Steve Loughran [mailto:[EMAIL PROTECTED] > 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
