Browse Source

The manual strongly encourages you to specify source/target levels, yet it gave no examples that did so! Putting

in some usages to plant the bug in people's minds. (Especially important for people just starting to use JDK
1.5, which changed the default source level.)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277171 13f79535-47bb-0310-9956-ffa450edef68
master
Jesse N. Glick 20 years ago
parent
commit
c84ce0470e
1 changed files with 14 additions and 4 deletions
  1. +14
    -4
      docs/manual/CoreTasks/javac.html

+ 14
- 4
docs/manual/CoreTasks/javac.html View File

@@ -416,31 +416,39 @@ used.</p>
destdir=&quot;${build}&quot;
classpath=&quot;xyz.jar&quot;
debug=&quot;on&quot;
source=&quot;1.4&quot;
/&gt;</pre>
<p>compiles all <code>.java</code> files under the <code>${src}</code>
directory, and stores
the <code>.class</code> files in the <code>${build}</code> directory.
The classpath used includes <code>xyz.jar</code>, and compiling with
debug information is on.</p>
debug information is on. The source level is 1.4,
so you can use <code>assert</code> statements.</p>

<pre> &lt;javac srcdir=&quot;${src}&quot;
destdir=&quot;${build}&quot;
fork=&quot;true&quot;
source=&quot;1.2&quot;
target=&quot;1.2&quot;
/&gt;</pre>
<p>compiles all <code>.java</code> files under the <code>${src}</code>
directory, and stores the <code>.class</code> files in the
<code>${build}</code> directory. This will fork off the javac
compiler using the default <code>javac</code> executable.</p>
compiler using the default <code>javac</code> executable.
The source level is 1.2 (similar to 1.1 or 1.3) and
the class files should be runnable under JDK 1.2+ as well.</p>

<pre> &lt;javac srcdir=&quot;${src}&quot;
destdir=&quot;${build}&quot;
fork=&quot;java$$javac.exe&quot;
source=&quot;1.5&quot;
/&gt;</pre>
<p>compiles all <code>.java</code> files under the <code>${src}</code>
directory, and stores the <code>.class</code> files in the
<code>${build}</code> directory. This will fork off the javac
compiler, using the executable named <code>java$javac.exe</code>. Note
that the <code>$</code> sign needs to be escaped by a second one.</p>
that the <code>$</code> sign needs to be escaped by a second one.
The source level is 1.5, so you can use generics.</p>

<pre> &lt;javac srcdir=&quot;${src}&quot;
destdir=&quot;${build}&quot;
@@ -455,7 +463,9 @@ directory, and stores the
The classpath used includes <code>xyz.jar</code>, and debug information is on.
Only files under <code>mypackage/p1</code> and <code>mypackage/p2</code> are
used. All files in and below the <code>mypackage/p1/testpackage</code>
directory are excluded from compilation.</p>
directory are excluded from compilation.
You didn't specify a source or target level,
so the actual values used will depend on which JDK you ran Ant with.</p>

<pre> &lt;javac srcdir=&quot;${src}:${src2}&quot;
destdir=&quot;${build}&quot;


Loading…
Cancel
Save