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. make sure you have put the template into the JAR. the <jar> task may need to explicitly ask for it, or you should be using <copy> to copy the files from their source dir to build/classes or wherever.

I would have an "unjar" target that used <unjar> to unjar a jar just built, so you can see what is going on. Once you are 100% sure that the resource is going in, then you can worry about classloading.

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

Reply via email to