Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 12907 invoked from network); 5 Jan 2006 09:05:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jan 2006 09:05:34 -0000 Received: (qmail 97918 invoked by uid 500); 5 Jan 2006 09:05:27 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 97829 invoked by uid 500); 5 Jan 2006 09:05:27 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 97783 invoked by uid 99); 5 Jan 2006 09:05:26 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jan 2006 01:05:26 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [192.6.10.17] (HELO gort.hpl.hp.com) (192.6.10.17) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jan 2006 01:05:24 -0800 Received: from kropotkin.hpl.hp.com (kropotkin.hpl.hp.com [15.144.59.2]) by gort.hpl.hp.com (8.12.10/8.12.10) with ESMTP id k0593wdL005302 for ; Thu, 5 Jan 2006 09:03:58 GMT Received: from localhost (localhost [127.0.0.1]) by kropotkin.hpl.hp.com (Postfix) with ESMTP id 433A74AFC for ; Thu, 5 Jan 2006 09:03:58 +0000 (GMT) Received: from kropotkin.hpl.hp.com ([127.0.0.1]) by localhost (kropotki [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 13092-03-2 for ; Thu, 5 Jan 2006 09:03:54 +0000 (GMT) Received: from timmay.hpl.hp.com (timmay-hb.hpl.hp.com [15.144.59.39]) by kropotkin.hpl.hp.com (Postfix) with ESMTP id 7D64576F1 for ; Thu, 5 Jan 2006 09:03:54 +0000 (GMT) Received: from [16.27.193.157] ([16.27.193.157]) by timmay.hpl.hp.com (8.13.2/8.13.2) with ESMTP id k0593mTo008105 for ; Thu, 5 Jan 2006 09:03:48 GMT Message-ID: <43BCE11B.8090305@apache.org> Date: Thu, 05 Jan 2006 09:04:27 +0000 From: Steve Loughran User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ant Users List Subject: Re: Loading resources from my task's JAR? References: <3F67459D-ADEC-41EA-93FA-09C08454D59A@latencyzero.com> In-Reply-To: <3F67459D-ADEC-41EA-93FA-09C08454D59A@latencyzero.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-HPLB-IMAP-MailScanner-Information: Please contact the Helpdesk for more information X-HPLB-IMAP-MailScanner: Found to be clean X-HPLB-IMAP-MailScanner-SpamCheck: not spam, SpamAssassin (score=0, required 5) X-Virus-Scanned: amavisd-new at kropotkin.hpl.hp.com X-HPL-MailScanner-Information: Please contact the Helpdesk for more information X-HPL-MailScanner: Found to be clean X-HPL-MailScanner-SpamCheck: not spam, SpamAssassin (score=-0.966, required 5, autolearn=not spam, AWL -0.97) X-MailScanner-From: stevel@apache.org X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 task may need to explicitly ask for it, or you should be using to copy the files from their source dir to build/classes or wherever. I would have an "unjar" target that used 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: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org