ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Message: modern compiler not found, classic will be used
Date Tue, 29 Jan 2002 23:22:34 GMT
--- Brian Burch <Brian@PingToo.com> wrote:
> In my case, and possibly some of the others back in time, the situation
> became confusing to diagnose because :-
> 1. JAVA_HOME *was* "apparently" set properly to the jdk 1.3.
> 2. javac ran perfectly from the command line.
> 3. tools.jar was NOT on the classpath after installing jdk 1.3

The 'javac' executable (and the 'java' executable as well) for JDK1.3
doesn't require anything at all be in the classpath -- it finds what it
needs on its own -- but it's an executable, not a Java program. The
<javac> task, on the other hand (I believe), when using the Sun compiler,
runs the compiler as a Java class, within the same JVM used to run Ant,
using the com.sun.tools.javac.Main() class, so it relies on the classpath
that was specified for running Ant, unless you explicitly tell it not to
and put your own classpath together for it from scratch (I do that when I
want to compile against 1.1.8, since I always run Ant with JDK1.3).

Personally, I never run Ant with a CLASSPATH env var set. Anything I need
that's not included in the generated classpath that the Ant wrapper script
pulls together, I prefer to explicitly have in my build-file(s) --
trusting to env vars for build configurations is just too risky a road to
go down (for a build engineer who has reproducibility as a high priority,
anyway :)

> 4. jdk 1.1 was not installed, so "boom"
> 5. put tools.jar into the ant execution classpath and "bingo, it works"

But you only need to do that if you're running Ant without using one of
the supplied wrapper scripts -- and then you're (quite reasonably) on your
own for making sure that whatever method you are using to run Ant takes
care of getting everything you need into place before executing Ant's
Main.

> I was lucky enough to find the an old posting in the archives that gave
> me the clue about tools.jar. This jar was not on my default classpath,
> but javac was still finding it. I don't understand why it was being
> found by javac from the command line,

See above explanation wrt 'javac', the exectuable.

> and not by the ant <javac> task,

It would only not be included in the classpath used to run Ant if a) you
weren't using one of the supplied wrapper scripts, or b) it didn't live in
the subdir-from-$JAVA_HOME that the wrapper scripts expect to find it.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message