mirror of
https://github.com/apache/ant.git
synced 2025-05-16 21:15:12 +00:00
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268652 13f79535-47bb-0310-9956-ffa450edef68
136 lines
4.6 KiB
HTML
136 lines
4.6 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Language" content="en-us">
|
|
<title>Ant User Manual</title>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h2><a name="java">Java</a></h2>
|
|
<h3>Description</h3>
|
|
<p>Executes a Java class within the running (Ant) VM or forks another VM if
|
|
specified.</p>
|
|
<p>Be careful that the executed class doesn't call System.exit(), because it
|
|
will terminate the VM and thus Ant. In case this happens, it's highly suggested
|
|
that you set the fork attribute so that System.exit() stops the other VM and not
|
|
the one that is currently running Ant.</p>
|
|
<h3>Parameters</h3>
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td valign="top"><b>Attribute</b></td>
|
|
<td valign="top"><b>Description</b></td>
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">classname</td>
|
|
<td valign="top">the Java class to execute.</td>
|
|
<td align="center" valign="top">Yes</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">args</td>
|
|
<td valign="top">the arguments for the class that is
|
|
executed. <b>deprecated, use nested <code><arg></code>
|
|
elements instead.</b></td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">classpath</td>
|
|
<td valign="top">the classpath to use.</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">classpathref</td>
|
|
<td valign="top">the classpath to use, given as <a
|
|
href="../using.html#references">reference</a> to a PATH defined elsewhere.</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">fork</td>
|
|
<td valign="top">if enabled triggers the class execution in another VM
|
|
(disabled by default)</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">jvm</td>
|
|
<td valign="top">the command used to invoke the Java Virtual Machine,
|
|
default is 'java'. The command is resolved by java.lang.Runtime.exec().
|
|
Ignored if fork is disabled.
|
|
</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">jvmargs</td>
|
|
<td valign="top">the arguments to pass to the forked VM (ignored
|
|
if fork is disabled). <b>deprecated, use nested
|
|
<code><jvmarg></code> elements instead.</b></td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">maxmemory</td>
|
|
<td valign="top">Max amount of memory to allocate to the forked VM
|
|
(ignored if fork is disabled)</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">failonerror</td>
|
|
<td valign="top">Stop the buildprocess if the command exits with a
|
|
returncode other than 0. Only available if fork is true.</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">dir</td>
|
|
<td valign="top">The directory to invoke the VM in. (ignored if
|
|
fork is disabled)</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">output</td>
|
|
<td valign="top">Name of a file to write the output to.</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
</table>
|
|
<h3>Parameters specified as nested elements</h3>
|
|
<h4>arg and jvmarg</h4>
|
|
<p>Use nested <code><arg></code> and <code><jvmarg></code>
|
|
elements to specify arguments for the or the forked VM. See <a
|
|
href="../using.html#arg">Command line arguments</a>.</p>
|
|
<h4>sysproperty</h4>
|
|
<p>Use nested <code><sysproperty></code>
|
|
elements to specify system properties required by the class.
|
|
These properties will be made available to the VM during the execution
|
|
of the class (either ANT's VM or the forked VM). The attributes
|
|
for this element are the same as for <a href="exec.html#env">environment
|
|
variables</a>.</p>
|
|
<h4>classpath</h4>
|
|
<p><code>Java</code>'s <i>classpath</i> attribute is a <a
|
|
href="../using.html#path">PATH like structure</a> and can also be set via a nested
|
|
<i>classpath</i> element.</p>
|
|
<h5>Example</h5>
|
|
<pre>
|
|
<java classname="test.Main" >
|
|
<arg value="-h"/>
|
|
<classpath>
|
|
<pathelement location="\test.jar"/>
|
|
<pathelement path="${java.class.path}"/>
|
|
</classpath>
|
|
</java>
|
|
</pre>
|
|
<h3>Examples</h3>
|
|
<pre> <java classname="test.Main"/></pre>
|
|
<pre> <java classname="test.Main"
|
|
fork="yes" >
|
|
<sysproperty key="DEBUG" value="true"/>
|
|
<arg value="-h"/>
|
|
<jvmarg value="-Xrunhprof:cpu=samples,file=log.txt,depth=3"/>
|
|
</java>
|
|
</pre>
|
|
|
|
<hr>
|
|
<p align="center">Copyright © 2000,2001 Apache Software Foundation. All rights
|
|
Reserved.</p>
|
|
|
|
</body>
|
|
</html>
|
|
|