ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Setting environment variables for a javac task
Date Fri, 22 Feb 2002 07:18:23 GMT
On Thu, 21 Feb 2002, Mike Kaufman <> wrote:

> Thanks a lot.  I'll try that.  Where is the latest Ant
> documentation?  The stuff at
> seems a little
> incomplete.

Depends on what you call the latest 8-)

The online manual is the manual that shipped with Ant 1.4.1, the
manual for the latest development version is part of the nightly
builds - or check out jakarta-ant/docs/manual from CVS.

> Believe it or not, I read the docs.  Unfortunately, I found them
> pretty vague.

Help us to improve them.

> For example, how does ant find the compiler you specify?

That depends on the build.compiler setting.

Some compilers are implemented in Java and will be invoked from the
CLASSPATH via reflection - i.e. they have to be on your CLASSPATH.
Others are external executables and Ant will Runtime.exec() them, they
have to be on your PATH.

> What if the specified compiler is not available?

Again it depends on the setting.  If the compiler is an executable and
is not on the PATH, you'll get a OS dependent error message (usually
completely unusable like IOError 2 or something) and the build process
will fail.  In the case of "modern", Ant will try to fall back to
"classic" which won't work with tools.jar from JDK 1.4.

> I imagine that what is really going on is the build.compiler
> property specifies the specific *ant class* to use to set up the
> command-line call to do the compiler.

Correct - but this class again may check which Java version it is
currently using and so may generate switches not appropriate for the
javac you want to run.  For example, Ant will never pass a -sourcepath
switch to the "classic" compiler if you are running it in a 1.2 or 1.3
JVM, even if you ask Ant to use the compiler of JDK 1.1.

> Now, <exec> supports <env> tags which I could use to achieve my
> goal, but I have no idea if I can leverage those <env> tags from a
> <javac> tag.

You can't without patching the code - and would need to be changed - and
even then it would only work if you set the fork attribute of <javac>
to true in the "modern" and "classic" cases.


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

View raw message