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 09:25:42 GMT
Ugh! Didn't notice that. 

Looking at the ant source it looks like this is ultimately
because the Project class has a 'properties' member variable
that is in fact a Hashtable! Too bad, cuz Properties objects
are case-insensitive but hashes are not.

Could the Property task doco be updated to mention the
case-sensitivity under windows?

Anyway, it's still a great feature!

Conor MacNeill wrote:
> 
> It is case sensitive and under Win2k, the Path is actually env.Path :-(
> 
> > -----Original Message-----
> > From: Phil Surette [mailto:philsurette@home.com]
> > Sent: Friday, 19 October 2001 4:41 PM
> > To: ant-user@jakarta.apache.org
> > 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" <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