ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Chaddock <>
Subject Re: Cross-compilation problem
Date Fri, 22 Feb 2008 18:11:34 GMT
Do you experience the same problem if you by-pass the javac task, and 
invoke javac using the exec task?

Obviously not a very nice work-around... but if it solves your 
problem.... :>.

Scot P. Floess wrote:
> That's really interesting!  To be honest I have not really had a need 
> to do something like that to date...
> I'll have to give this some more thought...
> Christian Schröder wrote:
>> Scot P. Floess wrote:
>>> Curious, why don't you just use the 1.5 javac but target 1.4?  That 
>>> should do what you want...  I think all you will need to do is this:
>>> <javac srcdir="src" destdir="classes" source="1.4" target="1.4"/>
>> The problem is that the 1.5 javac won't complain if I accidently use 
>> functions from the 1.5 api. It will create a class file which *looks* 
>> like 1.4 (as to the class version number), but cannot be executed by 
>> a 1.4 jvm.
>> Try the following example:
>> public class Test {
>>    public static void main(String[] args) {
>>        String s = "Hello World";
>>        int i = s.codePointAt(0);
>>    }
>> }
>> If I compile with "/usr/java/jdk1.5.0/bin/javac -source 1.4 -target 
>> 1.4" the compiler won't complain. However, if I start this 
>> app with a 1.4 jvm I get the following exception:
>> Exception in thread "main" java.lang.NoSuchMethodError: 
>> java.lang.String.codePointAt(I)I
>>        at Test.main(
>> The 1.4 compiler would have reported the following error:
>> cannot resolve symbol
>> symbol  : method codePointAt (int)
>> location: class java.lang.String
>>        int i = s.codePointAt(0);
>>                 ^
>> 1 error
>> That's why I try to use the compiler of the target platform.
>> Regards,
>>    Christian

E-mail is an informal method of communication and may be subject to data corruption, interception
and unauthorised amendment for which I-play, a trading name of Digital Bridges Ltd will accept
no liability. Therefore, it will normally be inappropriate to rely on information contained
on e-mail without obtaining written confirmation.

This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and
destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.

(C) 2005. I-play is a trademark and trading name of Digital Bridges Limited. All Rights Reserved.
This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service. For further information visit

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

View raw message