Browse Source

Provide access to the return code of the JavaVM when it is forked.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267735 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 25 years ago
parent
commit
83fd4e64cd
1 changed files with 12 additions and 2 deletions
  1. +12
    -2
      src/main/org/apache/tools/ant/taskdefs/Java.java

+ 12
- 2
src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -76,7 +76,16 @@ public class Java extends Exec {
* Do the execution.
*/
public void execute() throws BuildException {
executeJava();
}

/**
* Do the execution and return a return code.
*
* @return the return code from the execute java cklass if it was executed in
* a separate VM (fork = "yes").
*/
public int executeJava() throws BuildException {
project.log("Calling " + classname, "java", project.MSG_VERBOSE);

if (classname == null) {
@@ -101,12 +110,13 @@ public class Java extends Exec {
b.append(args);
}
run(b.toString());
return run(b.toString());
} else {
Vector argList = tokenize(args);
if (jvmargs != null) project.log("JVM args and classpath ignored when same JVM is used.", "java", project.MSG_VERBOSE);
project.log("Java args: " + argList.toString(), "java", project.MSG_VERBOSE);
run(classname, argList);
return 0;
}
}



Loading…
Cancel
Save