> -----Original Message-----
> From: Rick Mann [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 5 January 2006 8:26 PM
> To: Ant Users List
> Subject: Re: Loading resources from my task's JAR?
> 
> 
> On Jan 5, 2006, at 1:45 AM, Stephen McConnell wrote:
> 
> > This is not a issue of locating the jar file - after all 
> you running 
> > which means you class is loaded which means the JRE has located the 
> > class which means the jar is know.  If you task class is 
> > com/mycompany/tools/dbgen/DBGenAntTask.class then either of the 
> > following two approaches should work:
> >
> >    getClass().getResourceAsStream("Class.tmpl");
> >
> >    getClass().getResourceAsStream("/com/mycompany/tools/dbgen/
> > Class.tmpl");
> 
> My thoughts exactly. So, why is it returning null? 

In both cases?

> I only bring up all the other stuff because I was "thinking out 
> loud", trying to find something else to look for. Have you 
> (or anyone else) ever succeeded in doing this?

Sure.

First thing to do is to validate that the correct jar is referenced. 

E.g.:

  System.out.println( 
 
getClass().getProtectionDomain().getCodeSource().getLocation().toString() 
  );

Secondly, verify that the url returned from the above references the url
your assuming, and that it does contain the resources your expecting.

/Steve.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to