[kepler-dev] build.xml and JAVA_HOME
Christopher Brooks
cxh at eecs.berkeley.edu
Fri Apr 18 15:48:29 PDT 2008
Hi Aaron,
You modified build.xml with this log message:
Added a condition to the preinit target to make sure that the
environment variables are set. Otherwise, the build fails with a
message.
The diff is:
bash-3.00$ cvs diff -r 1.380 -r 1.381 build.xml
Index: build.xml
===================================================================
RCS file: /cvs/kepler/build.xml,v
retrieving revision 1.380
retrieving revision 1.381
diff -r1.380 -r1.381
4,6c4,6
< * '$Author: crawl $'
< * '$Date: 2008/04/02 21:09:41 $'
< * '$Revision: 1.380 $'
---
> * '$Author: aschultz $'
> * '$Date: 2008/04/17 23:45:07 $'
> * '$Revision: 1.381 $'
118a119,126
> <condition property="env_ok">
> <and>
> <isset property="env.PTII"/>
> <isset property="env.KEPLER"/>
> <isset property="env.JAVA_HOME"/>
> </and>
> </condition>
> <fail message="Environment not initialized: PTII=${env.PTII} KEPLER=${env.KEPLER} JAVA_HOME=${env.JAVA_HOME}" unless="env_ok"/>
This means that we are now requiring JAVA_HOME be set.
It looks like the automatic build is failing, see
ttp://nmi-s003.cs.wisc.edu/nmi/index.php?page=results/runDetails&runid=83360
If JAVA_HOME is not set, then I get this error message:
bash-3.00$ ant run-dev
Buildfile: build.xml
preinit:
BUILD FAILED
/export/home1/cxh/src/kepler/build.xml:126: Environment not initialized: PTII=/home/eecs/cxh/ptII KEPLER=/home/eecs/cxh/src/kepler JAVA_HOME=${env.JAVA_HOME}
Total time: 1 second
bash-3.00$
I looked at this message and had no clue that I had to set JAVA_HOME.
Perhaps the error message could be more explicit, perhaps each
variable could be checked separately?
However, it it really necessary that JAVA_HOME be set? Can't we
determine this programmatically? The problem is that if the
java in the user's path and JAVA_HOME are different, then there
will be problems.
In Ptolemy II, we compile and invoke ptII/config/JavaHome.java,
which will tell us the value of the java.home property.
What was the error message that you were seeing? Did it have
to do with compiling PtDoclet.java, which requires
${JAVA_HOME}/lib/tools.jar?
I'm not sure how best to handle this in ant, but is there
a way that ant can compile a Java program and use that value?
I'm somewhat resistant to have the user set JAVA_HOME, I've
found that it ends up causing no end of support problems.
BTW - The ant docs say that JAVA_HOME must be set, but the reality
is that ant works ok without JAvA_HOME being set.
IMHO - it is a bug in ant that I'm asked to set JAVA_HOME.
_Christopher
More information about the Kepler-dev
mailing list