From ec1635e90bde3598533a8e66cb2a25da0e31d31c Mon Sep 17 00:00:00 2001
From: Steve Loughran
Date: Mon, 10 Jan 2005 10:55:23 +0000
Subject: [PATCH] More on jar attribute
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277325 13f79535-47bb-0310-9956-ffa450edef68
---
docs/manual/CoreTasks/java.html | 41 +++++++++++++++++++++++++++++----
1 file changed, 37 insertions(+), 4 deletions(-)
diff --git a/docs/manual/CoreTasks/java.html b/docs/manual/CoreTasks/java.html
index 8d4d494a7..d087608d2 100644
--- a/docs/manual/CoreTasks/java.html
+++ b/docs/manual/CoreTasks/java.html
@@ -30,13 +30,15 @@ EOF (-1). This is a change from Ant 1.5, where such an attempt would block.
classname |
the Java class to execute. |
- Either jar or classname |
+ Either jar or classname |
jar |
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. |
- Either jar or classname |
+ Main-Class entry in the manifest). Fork must be set to true if this option is selected.
+ See notes below for more details.
+
+ Either jar or classname |
args |
@@ -276,6 +278,16 @@ error and would mean the build exits.
Similarly, if failonerror="false"
and fork="false"
, then <java>
must return 0 otherwise the build will exit, as the class was run by the build jvm.
+JAR file execution
+
+The parameter of the jar attribute is of type File;
+that is, the parameter is resolved to an absolute file relative to the
+base directory of the project, not 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.
+
+
Examples
<java classname="test.Main">
@@ -300,9 +312,30 @@ Run a class in this JVM with a new jar on the classpath
</classpath>
</java>
-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.
+ <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>
+
+
+Run the JAR dist/test.jar relative to the directory
+${exec.dir}, this being the same directory into which the JVM
+is to start up.
+
+
<java classname="test.Main"/>
<java classname="test.Main"
fork="yes" >