You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by st...@apache.org on 2005/01/10 11:55:23 UTC
cvs commit: ant/docs/manual/CoreTasks java.html
stevel 2005/01/10 02:55:23
Modified: docs/manual/CoreTasks java.html
Log:
More on jar attribute
Revision Changes Path
1.34 +37 -4 ant/docs/manual/CoreTasks/java.html
Index: java.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTasks/java.html,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- java.html 19 Nov 2004 09:07:09 -0000 1.33
+++ java.html 10 Jan 2005 10:55:23 -0000 1.34
@@ -30,13 +30,15 @@
<tr>
<td valign="top">classname</td>
<td valign="top">the Java class to execute.</td>
- <td align="center" valign="top">Either jar or classname</td>
+ <td align="center" valign="top">Either <tt>jar</tt> or <tt>classname</tt></td>
</tr>
<tr>
<td valign="top">jar</td>
<td valign="top">the location of the jar file to execute (must have a
- Main-Class entry in the manifest). Fork must be set to true if this option is selected.</td>
- <td align="center" valign="top">Either jar or classname</td>
+ Main-Class entry in the manifest). Fork must be set to true if this option is selected.
+ See notes below for more details.
+ </td>
+ <td align="center" valign="top">Either <tt>jar</tt> or <tt>classname</tt></td>
</tr>
<tr>
<td valign="top">args</td>
@@ -276,6 +278,16 @@
<p> Similarly, if <code>failonerror="false"</code> and <code>fork="false"</code>
, then <code><java></code> <b>must</b> return 0 otherwise the build will exit, as the class was run by the build jvm.</p>
+<h3>JAR file execution</h3>
+
+The parameter of the <tt>jar</tt> attribute is of type <tt>File</tt>;
+that is, the parameter is resolved to an absolute file relative to the
+base directory of the project, <i>not</i> the directory in which the Java
+task is run. If you need to locate a JAR file relative to the directory
+the task will be run in, you need to explicitly create the full path
+to the JAR file.
+
+
<h3>Examples</h3>
<pre>
<java classname="test.Main">
@@ -300,8 +312,29 @@
</classpath>
</java>
</pre>
-Run the jar using the manifest supplied entry point, forking (as required),
+Run the JAR test.jar in this project's dist/lib directory.
+using the manifest supplied entry point, forking (as required),
and with a maximum memory of 128MB. Any non zero return code breaks the build.
+
+<pre> <java
+ dir="${exec.dir}"
+ jar="${exec.dir}/dist/test.jar"
+ fork="true"
+ failonerror="true"
+ maxmemory="128m"
+ >
+ <arg value="-h"/>
+ <classpath>
+ <pathelement location="dist/test.jar"/>
+ <pathelement path="${java.class.path}"/>
+ </classpath>
+ </java>
+</pre>
+
+Run the JAR dist/test.jar relative to the directory
+<tt>${exec.dir}</tt>, this being the same directory into which the JVM
+is to start up.
+
<pre> <java classname="test.Main"/></pre>
<pre> <java classname="test.Main"
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org