ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyril Bouteille <>
Subject Re: reading system variables?
Date Tue, 14 Nov 2000 21:12:26 GMT

> Thanks Cyril, it helped. So Should I assume that any arbitrary system
> variables that I define, like MYPATH, I must pass it in as arguments to Ant?
> is that true?

I'm not sure there's no other way, but that's the only one I found. :)
I currently use my own ant script which invoke the ant main class with
-D properties in order to make my build.xml file portable to different

> How about if I am running it on a UNIX platform, do I still
> use -DOS? 

I think there's a little confusion here. When I said you can start ant
with -Dos.path=$PATH, it has nothing to do with DOS. -Dkey=value is a
standard java option allowing you to pass properties to the JVM. I used
the property name "os.path" as a an example (OperatingSystem.PATH) but
you can use any name you want.

> Also, is there a list of predefined properties for Ant?

You can see all the standard properties by running
$ ant -debug
You'll see a bunch of "Setting project property:" lines.


> -----Original Message-----
> From: Cyril Bouteille []
> Sent: Tuesday, November 14, 2000 11:10 AM
> To:
> Subject: Re: reading system variables?
> Hadi,
> > Is there a way to read the System variables like PATH or CLASSPATH with
> Ant?
> You can access the CLASSPATH variable using ${java.class.path} in Ant.
> For the PATH, you can start ant with -Dos.path=$PATH and access it in
> Ant using ${os.path}.
> Hope it helps,
View raw message