Andrew McIntyre wrote:
On 3/14/07, Daniel John Debrunner <[EMAIL PROTECTED]> wrote:
Does this mean ant is calling some java api to the compiler and uses
$JAVA_HOME as the jar files for the compiler?
Yes, Ant acquires the main compiler class by reflection. See
org.apache.tools.ant.taskdefs.Javac13 if you're interested.
(My situation is that JAVA_HOME does not match the JDK 1.4.2 I have
setup in my ant.properties and I'm wondering which compiler is being
used.)
It's whatever JDK is being used to invoke Ant. The easiest way to
determine that is by running 'ant -verbose', it will be third line of
output. Depending on how you invoke ant, it might not be what is in
your PATH or JAVA_HOME. E.g. if you install Apple's Java developer
tools on Mac OS X, then running 'ant' in the shell invokes whatever is
the current base JDK level for Mac OS X, and is not what is in your
PATH or even in JAVA_HOME.
From this, I take it that ant uses the compiler from the JDK used to
invoke ant, if possible. If it doesn't find a "known" JDK, it looks in
$JAVA_HOME/bin. And the third line of output in any 'ant -verbose' or
'ant -v' command shows the Java version used. But does it also show
which compiler is used?
When I have my PATH set to JDK 1.5, and don't set JAVA_HOME, it reports
the path to the JDK 1.5 jre/ directory. However, when I set JAVA_HOME to
JDK 1.4, it reports the path to the JDK 1.4 jre/ directory instead. In
the latter case, which compiler is used, 1.5 or 1.4?
Sorry for the confusion,
--
John