On Thu, 1 Jun 2006, Jan Materne <[EMAIL PROTECTED]> wrote: >>Not sure if we can build Ant 1.7 under JDK 1.5 also all in one >>go and still produce jars which can run under 1.2. > > Should be possible (but I would do a test after the build...) > > http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javac.html > -target version Generate class files that will work on VMs with the > specified version.
That's only one part of the problem. The other one is that you might be using methods introduced in later versions of the class library "by accident". Say there is a method void doSomething(Object o); in a class inside the Java class library of JDK 1.3 and a new overload void doSomething(String s); was added in JDK 1.4. Any call to doSomething("") compiled on JDK 1.4 and above will pick the String signature and fail with a NoSuchMethodError (or IncompatibleClassChange, not sure) when run on JDK 1.3. There are several examples of changes like this in the JDK so you can't be sure it works just bbbe setting the correct target. Java 5 adds a completely new sort of problems with APIs retrofitted to support generics. Since Comparable is now Comparable<T> the BigInteger class used to have a method int compareTo(Object) and now has a int compareTo(BigInteger) and no Object signature alternative. It is impossible to compile code on JDK 1.5 that uses the method and still works on JDK 1.4 - but the opposite is also true. Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]