Return-Path: Delivered-To: apmail-jakarta-ant-user-archive@apache.org Received: (qmail 41719 invoked from network); 8 May 2002 19:35:11 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 8 May 2002 19:35:11 -0000 Received: (qmail 14562 invoked by uid 97); 8 May 2002 19:35:08 -0000 Delivered-To: qmlist-jakarta-archive-ant-user@jakarta.apache.org Received: (qmail 14546 invoked by uid 97); 8 May 2002 19:35:08 -0000 Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 14534 invoked by uid 98); 8 May 2002 19:35:07 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <98D21B073202584C9125C860580DC4ED0F5086@lgchexch006.ad.lgc.com> From: Dominique Devienne To: "'Ant Users List'" Subject: RE: setting environment variables using ant Date: Wed, 8 May 2002 14:35:03 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N A child process (the Java VM running ANT) cannot modify the environment of its parent process (the DOS command line interpreter, cmd.exe). Even script cannot do what you ask on Unix when you 'run' them, only when you 'source' them (must be compatible with the shell currently running). DOS .bat files are always 'sourced' by default, so they modify the current DOS session, unless the .bat calls setlocal before modifying its own environment. So in short, using ANT as a kind of scripting replacement for .bat files is not possible. All is not lost though, as Erik pointed out... If you define an ANT target to run your java program, you can easily define with ANT the classpath it should use. But then again, ANT is not an application launcher either, although it can do it (hangs around, and filters the output though, since the 'start and forget' capability of doesn't seem to make it into ANT)... Oh well, I guess this is not really helpful after all. --DDs -----Original Message----- From: raghavendra@hss.hns.com [mailto:raghavendra@hss.hns.com] Sent: Wednesday, May 08, 2002 9:10 AM To: ant-user@jakarta.apache.org Subject: setting environment variables using ant Hi, I have been using ant for a month or so and find it very useful and cool. I am not able to solve the following problem for a couple of days... I want to set Environment variables from ANT. Say ... I want to run a java program. The usage should be e:\> ant setclasspath (setclasspath is the target which should set the classpath appropriately) This target should set the classpath variable to some string in the build.xml (it could be a variable/property). Next I should be able to do the following e:\> java MyProgram (classpath should be set to access MyProgram in the previous step). I am sure guys out here must have used ant extensively. Would be glad to receive suggestions on doing this. Thanks. Regards, Raghu -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: