ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: JAVA_HOME, JAVACMD, javac and junit
Date Wed, 13 Oct 2004 14:33:29 GMT
On Tue, 12 Oct 2004, Phil Weighill-Smith
<> wrote:

> I don't understand why the "javac" task requires the "executable"
> attribute to be specified when attempting to do this (the
> documentation says it defaults to the compiler for the JDK that Ant
> is run by...  surely this *should* default to the one found in
> JAVA_HOME instead).

Ant and its developers seem to disagree with your "surely" 8-)

JAVA_HOME is really only used to locate the java executable (unless
you specify JAVACMD) and tools.jar (and even this won't use it anymore
with Ant 1.6.x).  It's just an environment variable with no special
meaning once Ant has started.  To Ant, environment variables become
irrelevant once we are in the pure Java part of it - and rightly so
since not all OSes support them and reading them is a pain pre JDK

On top of that, changing the way Ant works here would break the builds
of people who are happy with running Ant without setting JAVA_HOME at

> What do people think about the defaults for javac executable and
> junit jvm?

They match what I would expect.

> Has anyone tried to do this sort of thing (different Ant and
> javac/junit Javas)? If so, any hints or tips welcome!

Yes, I've done what you described.  forked javac and forked junit with
jvm/executable specified.

You can simplify it in your case by reading the environment into
properties and using ${env.JAVA_HOME} to build the path to your
executables, but that's about it.


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

View raw message