ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Anson <dan...@grafidog.com>
Subject Re: Building with JDK 1.3. Which version of ANT?
Date Thu, 30 Jul 2009 15:55:28 GMT
I ran into a similar problem just this morning with Java 1.5 and Java
1.6 incompatibility.  In your javac task in your build file, you
should also set the bootclasspath, and point it to the rt.jar for Java
1.3.  This will help you not introduce usage of Java 1.5 APIs into
your Java 1.3 build since the compiler will complain if it finds any.
See the "Cross-Compilation Example" at the bottom of this page:

http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html

Dale


On Thu, Jul 30, 2009 at 9:01 AM, Rez P<pons32@hotmail.com> wrote:
>
> Thanks for all your help and input.
>
>
>
>
>
>> To: user@ant.apache.org
>> Subject: Re: Building with JDK 1.3. Which version of ANT?
>> From: bodewig@apache.org
>> Date: Thu, 30 Jul 2009 12:11:45 +0200
>>
>> On 2009-07-30, Rez P <pons32@hotmail.com> wrote:
>>
>> > I just got a successful build by using jdk 1.5, ant 1.7, and setting
>> > source & target attributes of the javac ant task to 1.3. Do you see
>> > any problem with this configuration as far as jdk 1.5 adding
>> > unwanted stuff to my generated class files as opposed to, if I set
>> > my entire environment to jdk 1.3 and making sure that the old
>> > project doesn't become polluted with any new tools or libraries?
>>
>> One thing is that you might use classes or methods present in Java 1.5
>> but not in 1.3 - this will compile on Java5 but fail if you try to run
>> the code on 1.3. This may be possible to avoid if you are disciplined
>> enough 8-)
>>
>> Unfortunately there are problems more subtle than that. If Java5 (or
>> 1.4) have introduced new method overloads the compiler may choose one
>> that doesn't exist in 1.3.
>>
>> One example that I've encountered myself
>> StringBuffer.append(StringBuffer) which was added in Java 1.4. say
>> you have
>>
>> StringBuffer sb1 = new StringBuffer();
>> StringBuffer sb2 = new StringBuffer();
>> sb2.append(sb1);
>>
>> This will compile fine on both JDKs. javac of JDK 1.3 (and earlier)
>> will use append(Object), any later javac will use append(StringBuffer).
>> Code compiled on Java 1.4 or later will throw an exception when run on
>> Java 1.3 or earlier.
>>
>> These kinds of problems are way more difficult to catch when
>> "cross-compiling".
>>
>> Stefan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>
> _________________________________________________________________
> Windows Live™ Hotmail®: Search, add, and share the web’s latest sports videos. Check
it out.
> http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_videos_072009&cat=sports

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


Mime
View raw message