Return-Path: Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 83730 invoked from network); 4 Dec 2000 14:42:34 -0000 Received: from bodewig.bost.de (root@195.227.98.11) by locus.apache.org with SMTP; 4 Dec 2000 14:42:34 -0000 Received: (from bodewig@localhost) by bodewig.bost.de (8.9.3/8.9.3) id PAA10719; Mon, 4 Dec 2000 15:42:32 +0100 X-Authentication-Warning: bodewig.bost.de: bodewig set sender to bodewig@apache.org using -f To: ant-user@jakarta.apache.org Subject: Re: Having a problem with the classpath passed to task References: <6DDA62170439D31185750000F80826AC0498F66F@zmerd004.ca.nortel.com> From: Stefan Bodewig Date: 04 Dec 2000 15:42:32 +0100 In-Reply-To: "Jay Glanville"'s message of "Mon, 4 Dec 2000 08:27:05 -0600" Message-ID: Lines: 53 User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Jay Glanville wrote: > I am trying to compile my source code to a target 1.1 VM. The > compilers I like to use are Jikes and javac 1.3. My problem is that > when I use the task in conjunction with a 1.3 runtime > environment, the tools.jar file gets included in the classpath if > I'm using the modern compiler, and tools.jar and rt.jar if I'm using > the jikes compiler. This is the major reason that I cannot use Ant > in my build environment. This is a known problem and you'll probably have attributes in to suppress this behavior in Ant 1.3. > Is there anything I can do to solve this problem (excluding having > to use a task) ? As a workaround, write your own implementation of Javac, a very simple and untested idea: public class MaJavac extends Javac { protected Path getCompileClasspath(boolean addRuntime) { return super.getCompileClasspath(false); } This will suppress rt.jar even when compiling with Jikes. You can copy what Javac's getCompileClasspath does and omit the line classpath.addExisting(Path.systemClasspath); to get rid of tools.jar as well. At the top of your buildfile say and you are done. > While I'm on the subject of unwanted stuff in the classpath, is > there any way that I can get rid of the ant libraries? I know that > there is very little chance of namespace collisions, or any other > worries. But it would be nice to simply have the following as an > execution line: jikes -d F:\test\classes -classpath > C:\jdk\1.1.8\lib\classes.zip;F:\test\classes;F:\test\src Yes, the second option above (omitting Path.systemClasspath) should do that as well. You could as well add options to (1) omit the runtime libraries and (2) omit the CLASSPATH Ant has been invoked with to Javac, make the modifications necessary to getCompileClasspath and contribute the patch so you will see this feature in CVS sooner 8-). Stefan