I think the point to make is that the same JDK will be used regardless
of the values of build.compiler or compiler attribute, but the
difference will be in the compiled classes that are outputted, that is
setting compiler to javac1.4 will generate class files compatible with
java version 1.4 and later.  If you want to compile your code under a
different JDK than the $JAVA_HOME JDK then set fork="true" and set the
executable attribute to where ever the executable is of the external
java compiler is.

-----Original Message-----
From: Rob Hills [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 9 March 2005 12:45 AM
To: [email protected]
Subject: Building Java code with a different version

Hi All,

I'm struggling with a build script that needs to be able to compile and
jar java code against different JDKs, depending on a property setting.

>From my reading of the Ant docs, I should be able to use either the
build.compiler property or the compiler attribute to specify which JDK I
want the java source compiled with.  In my situation it's either 1.4 or
1.5.

My build machine has the JAVA_HOME environment variable pointing to the
JDK 1.5 version and this always seems to be used to compile the code,
regardless of what I do with the "build.compiler" property or "compiler"
attribute.

I've been trying to set the "build.compiler" property within my ant
script - will this work, or can this only be set via an ANT_OPTS
commandline option?  In any case, if I leave out the build.compiler
property and just set the "compiler" attribute to "javac1.4", I still
get classes compiled using JDK 1.5.

I suspect I'm misunderstanding something here, can anyone set me right?

TIA,

Rob Hills
Waikiki, WA
Mobile (0412) 904-357
Fax: (08) 9529-2137


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]





****************************************************************
                            IMPORTANT

 The information transmitted is for the use of the intended recipient only and 
may contain confidential and/or legally privileged material. Any review, 
re-transmission, disclosure dissemination or other use of, or taking of any 
action in reliance upon, this information by persons or entities other than the 
intended recipient is prohibited and may result in severe penalties.  If you 
have received this e-mail in error please notify the Privacy Hotline of the 
Australian Taxation Office, telephone 13 28 69 and delete all copies of this 
transmission together with any attachments. 
****************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to