gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: 1.1 still hanging about??
Date Tue, 19 Oct 2004 08:03:20 GMT
On Tue, 19 Oct 2004, Niclas Hedhman <> wrote:

> Anyone has any clue what this is?


If you use <javac> without a target attribute, Ant won't use the
-target command line switch.  Sun changed the default of -target 1.3
to -target 1.4 with JDK 1.4 so many builds switched to specifying
target="1.1" to create classes that can be used on older JDKs.

Now the same happens to the source attribute.  If you leave it off,
Ant won't pass -source to the compiler.  In JDK 1.4 the default for
-source has been 1.3 which means -target 1.1 is fine (and thus nobody
specified the source attribute).  With JDK 1.5 they changed the
default to 1.4 and then a 

<javac target="1.1"/>

will use -target 1.1 -source 1.4 implicitly on JDK 1.5 which is an
incompatible combination of argument.

To make things worse, -target 1.1 -source 1.3 doesn't work for JDK 1.5
either IIRC and at the same time -source doesn't allow 1.2 or 1.1 in
JDK 1.4 so you need to do something silly like the Ant build file

  <target name="javac.preset" depends="javac.preset.1.5+,javac.preset.1.5-"/>
  <target name="javac.preset.1.5+" depends="check_for_optional_packages"
    <presetdef name="javac.preset">
      <javac source="${javac.source}"/>
  <target name="javac.preset.1.5-" depends="check_for_optional_packages"
    <presetdef name="javac.preset">

in order to support all JDKs properly.


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

View raw message