I am working on Windows 2000. Below is my implementation to get an system
env from ant.

<project default="compile" basedir=".">
        <!--
=================================================================== -->
        <!-- Initialization target
-->
        <!--
=================================================================== -->
        <target name="init">
                <tstamp/>
                <property environment="ENV"/>
                <property name="ANTCONF_DIR" value="${ENV.WORK_DIR}/src"/>
                <property name="SRC" value="${user.dir}"/>
        </target>
        <!--
=================================================================== -->
        <!-- Compiles the source directory
-->
        <!--
=================================================================== -->
        <target name="compile" depends="init">
                <ant antfile="${ANTCONF_DIR}/build_cfg.xml"
target="compile"/>
        </target>
</project>

jerry

-----Original Message-----
From: Phil Surette [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 18, 2001 11:41 PM
To: [EMAIL PROTECTED]
Subject: Re: retrieve env vars thru ant


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" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> 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.

-------------------------------------------------------------------------- 
Note:  The information contained in this message may be privileged and
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this communication is
strictly prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and deleting it from
your computer. Thank you. 
--------------------------------------------------------------------------

Reply via email to