ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Surette <philsure...@home.com>
Subject Re: retrieve env vars thru ant
Date Fri, 19 Oct 2001 06:41:14 GMT
Since there is no way to get at environment variables from
java, I was stunned to see that you could do it and ran
off to create a test script. 

...catch is it doesn't work under Windows 2000. 

<project default='echoenv'>
    <property environment='env'/>
    <property name="test" value="hello whirled"/>

    <target name='echoenv'>
        <echo>path = ${env.PATH}
            test = ${test}</echo>
    </target>
</project>

output:
Buildfile: build.xml

echoenv:
     [echo] path = ${env.PATH}
            test = hello whirled

BUILD SUCCESSFUL

Total time: 2 seconds

I guess Win2000 is not one of the 'select' platforms
that the task works under... 

Steve Loughran wrote:
> 
> ----- Original Message -----
> From: "Erik Hatcher" <jakarta-ant@ehatchersolutions.com>
> To: <ant-user@jakarta.apache.org>
> Sent: Thursday, October 18, 2001 09:06
> Subject: Re: retrieve env vars thru ant
> 
> > As for JAVA_HOME, you can access it already with ${java.home}.  (although
> > it'll likely have "jre" appended to what the environment variable actually
> > says.)
> 
> I am not sure they are the same. JAVA_HOME usually points to the JDK base,
> but java.home can refer to wherever the current JRE is, right? So if you
> have the JDK but run off a JRE under Program Files then java.home can be a
> long way from JAVA_HOME
> 
> > For other environment variables, have a look at <property
> environment=".....
> > />
> >
> 
> that's what I use.

Mime
View raw message