ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: How to get env variables from property file
Date Sun, 21 Jul 2002 19:41:13 GMT
Are you going to read this or not???
if it ain't what you want, just say so... --DD

As long as you enable accessing env. vars *before* loading the properties
file, then you're OK.

<target name="test">
  <property environment="env"/>
  <property file=""/>
  <echo message="${MY_JAVA_HOME}"/>


will echo either the value of JAVA_HOME is the env. var is set, or
${MY_JAVA_HOME} if it's not. Look at the documentation for <javac> for
compiling with a different JDK. This was also discussed before, so must be
in the archives. --DD

-----Original Message-----
From: Andre Susantin []
Sent: Friday, July 19, 2002 5:02 PM
Subject: How to get env variables from property file

I installed jsdk 1.3.1 and 1.4 locally d:\jdk1.3.1 (JAVA_HOME) and d:\jdk1.4
(JAVA_HOME14), and I can get the  the environment
varible to ant.
The question is how, to get the env variables from property file instead of
changing the build script itself?
I want to be able to compile with a different java version based on some
property in property file.
<project name="build">
	<property environment="env" />
	<property name="build.sysclasspath" value="last"/>
	<path id="my.classpath">
		<pathelement location="${srcdir}"/>
	      <fileset dir="${env.JAVA_HOME14}/lib">
        	<include name="**/*.jar"/>
I could use property name like "MY_JAVA_HOME"
<fileset dir="${MY_JAVA_HOME}/lib">
        	<include name="**/*.jar"/>
And override it -DMY_JAVA_HOME=d:/jdk1.4 eg., but I prefer setting it on
property file instead
Any suggestions?



Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message