Name

java

Synopsis

Executes a Java class using Ant’s VM instance or by forking a new VM process. If the executed application calls System.exit( ), be sure to set fork="true" or Ant will exit.

Attributes

args (all, String, N)

Deprecated in Ant 1.2; use nested <arg> elements instead.

classname (all, String, *)

The name of the Java class to execute.

classpath (all, Path, N)

The classpath to use. This is added to Ant’s classpath unless fork="true".

classpathref (all, Reference, N)

A reference to a classpath defined elsewhere in the buildfile.

dir (all, File, N)

The working directory for the VM. Ignored unless fork="true".

failonerror (all, boolean, N)

If true, the build fails when the command returns anything other than 0. Defaults to false. Ignored unless fork="true".

fork (all, boolean, N)

If true, the class is executed in a new VM instance. Defaults to false.

jar (1.4, File, *)

The name of an executable JAR file to execute. The JAR file must contain a Main-Class manifest entry, and fork must be true.

jvm (all, String, N)

The command name of the Java interpreter (may be a full pathname to the command). Defaults to java. Ignored unless fork="true".

jvmargs (all, String, N)

Deprecated in Ant 1.2; use nested <jvmarg> elements instead.

maxmemory (all, String, N)

Maximum amount of memory allocated for the forked VM. Ignored unless fork="true". Equivalent to -mx or -Xmx Java command-line options, depending on which version of Java is in use.

output (1.3, 1.4, File, N)

A filename to write output to.

Either ...

Get Ant: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.