Return-Path: Delivered-To: apmail-jakarta-ant-user-archive@jakarta.apache.org Received: (qmail 75804 invoked by uid 500); 15 Aug 2001 20:41:39 -0000 Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: ant-user@jakarta.apache.org Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 75778 invoked from network); 15 Aug 2001 20:41:39 -0000 Message-ID: <098c01c125cb$50b4cea0$8b00000a@TariqM> From: "T Master" To: "ant user mailist" Subject: loading classes in a custom task Date: Wed, 15 Aug 2001 14:46:10 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Given a fileset of *.jar is passed to a custom task, how can MyTask load the classes it requires? I have a classpath attribute that is a fileset. I've passed this to my task. As this is a collection of jar files, what now must be done to load the class? Code snippet appreciated. e.g. public class MyTask { Path classpath = null; /** * Set the classpath to be used for this compilation. */ public void setClasspath(Path aClasspath) { if (this.classpath == null) { this.classpath = aClasspath; } else { this.classpath.append(aClasspath); } } /** * Set the classpath to be used for this compilation. */ public void addClasspath(Path aClasspath) { if (this.classpath == null) { this.classpath = aClasspath; } else { this.classpath.append(aClasspath); } } /** * Creates a nested classpath element. */ public Path createClasspath() { if (classpath == null) { classpath = new Path(project); } return classpath.createPath(); } /** * Adds a reference to a CLASSPATH defined elsewhere. */ public void setClasspathRef(Reference r) { createClasspath().setRefid(r); } public void execute() throws BuildException() { . . . // need to load class javancss.Javancss as it is not in our system classpath. javancss.Javancss ncss = new javancss.Javancss( cmdArgs, Main.S_RCS_HEADER); } } T Master.