| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.Java
Launcher for Java applications. Allows use of the same JVM for the called application thus resulting in much faster operation.
| Field Summary | |
| protected  Redirector | redirector | 
| protected  RedirectorElement | redirectorElement | 
| Fields inherited from class org.apache.tools.ant.Task | 
| description, location, target, taskName, taskType, wrapper | 
| Fields inherited from class org.apache.tools.ant.ProjectComponent | 
| project | 
| Constructor Summary | |
| Java() | |
| Method Summary | |
|  void | addAssertions(Assertions asserts)assertions to enable in this program (if fork=true) | 
|  void | addConfiguredRedirector(RedirectorElement redirectorElement)Add a RedirectorElementto this task. | 
|  void | addEnv(Environment.Variable var)Adds an environment variable. | 
|  void | addSysproperty(Environment.Variable sysp)Adds a system property. | 
|  void | addSyspropertyset(PropertySet sysp)Adds a set of properties as system properties. | 
|  void | clearArgs()Clear out the arguments to this java task. | 
|  Commandline.Argument | createArg()Adds a command-line argument. | 
|  Path | createBootclasspath()Adds a path to the bootclasspath. | 
|  Path | createClasspath()Adds a path to the classpath. | 
|  Commandline.Argument | createJvmarg()Adds a JVM argument. | 
|  Permissions | createPermissions()Sets the permissions for the application run inside the same JVM. | 
| protected  ExecuteWatchdog | createWatchdog()Create the Watchdog to kill a runaway process. | 
|  void | execute()Do the execution. | 
|  int | executeJava()Do the execution and return a return code. | 
|  CommandlineJava | getCommandLine()accessor to the command line | 
|  CommandlineJava.SysProperties | getSysProperties()get the system properties of the command line | 
| protected  void | handleErrorFlush(java.lang.String output)Handle output sent to System.err and flush the stream. | 
| protected  void | handleErrorOutput(java.lang.String output)Handle output sent to System.err | 
| protected  void | handleFlush(java.lang.String output)Pass output sent to System.out to specified output file. | 
|  int | handleInput(byte[] buffer,
            int offset,
            int length)Handle an input request by this task | 
| protected  void | handleOutput(java.lang.String output)Pass output sent to System.out to specified output file. | 
| protected  void | maybeSetResultPropertyValue(int result)helper method to set result property to the passed in value if appropriate | 
| protected  void | run(java.lang.String classname,
    java.util.Vector args)Executes the given classname with the given arguments as it was a command line application. | 
|  void | setAppend(boolean append)If true, append output to existing file. | 
|  void | setArgs(java.lang.String s)Deprecated: use nested arg instead. | 
|  void | setClassname(java.lang.String s)Sets the Java class to execute. | 
|  void | setClasspath(Path s)Set the classpath to be used when running the Java class | 
|  void | setClasspathRef(Reference r)Classpath to use, by reference. | 
|  void | setDir(java.io.File d)The working directory of the process | 
|  void | setError(java.io.File error)File the error stream of the process is redirected to. | 
|  void | setErrorProperty(java.lang.String errorProperty)Property name whose value should be set to the error of the process. | 
|  void | setFailonerror(boolean fail)If true, then fail if the command exits with a returncode other than 0 | 
|  void | setFork(boolean s)If true, execute in a new VM. | 
|  void | setInput(java.io.File input)Set the input to use for the task | 
|  void | setInputString(java.lang.String inputString)Set the string to use as input | 
|  void | setJar(java.io.File jarfile)The location of the JAR file to execute. | 
|  void | setJvm(java.lang.String s)Set the command used to start the VM (only if forking). | 
|  void | setJvmargs(java.lang.String s)Set the command line arguments for the JVM. | 
|  void | setJVMVersion(java.lang.String value)Sets the JVM version. | 
|  void | setLogError(boolean logError)Controls whether error output of exec is logged. | 
|  void | setMaxmemory(java.lang.String max)Corresponds to -mx or -Xmx depending on VM version. | 
|  void | setNewenvironment(boolean newenv)If true, use a completely new environment. | 
|  void | setOutput(java.io.File out)File the output of the process is redirected to. | 
|  void | setOutputproperty(java.lang.String outputProp)Property name whose value should be set to the output of the process. | 
|  void | setResultProperty(java.lang.String resultProperty)The name of a property in which the return code of the command should be stored. | 
|  void | setSpawn(boolean spawn)set whether or not you want the process to be spawned default is not spawned | 
|  void | setTimeout(java.lang.Long value)Timeout in milliseconds after which the process will be killed. | 
| protected  void | setupRedirector()Set up properties on the redirector that we needed to store locally. | 
| Methods inherited from class org.apache.tools.ant.Task | 
| getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType | 
| Methods inherited from class org.apache.tools.ant.ProjectComponent | 
| getProject, setProject | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
protected Redirector redirector
protected RedirectorElement redirectorElement
| Constructor Detail | 
public Java()
| Method Detail | 
public void execute()
             throws BuildException
execute in class TaskBuildException - if failOnError is set to true and the application
 returns a non 0 result code
public int executeJava()
                throws BuildException
BuildException - if required parameters are missingpublic void setSpawn(boolean spawn)
spawn - if true you do not want ant to wait for the end of the processpublic void setClasspath(Path s)
s - an Ant Path object containing the classpath.public Path createClasspath()
public Path createBootclasspath()
public Permissions createPermissions()
public void setClasspathRef(Reference r)
r - a reference to an existing classpath
public void setJar(java.io.File jarfile)
            throws BuildException
jarfile - the jarfile that one wants to execute
BuildException - if there is also a main class specified
public void setClassname(java.lang.String s)
                  throws BuildException
s - the name of the main class
BuildException - if the jar attribute has been setpublic void setArgs(java.lang.String s)
s - argumentspublic Commandline.Argument createArg()
public void setResultProperty(java.lang.String resultProperty)
resultProperty - name of propertyprotected void maybeSetResultPropertyValue(int result)
result - the exit codepublic void setFork(boolean s)
s - do you want to run Java in a new VM.public void setJvmargs(java.lang.String s)
s - jvmargspublic Commandline.Argument createJvmarg()
public void setJvm(java.lang.String s)
s - command to start the VMpublic void addSysproperty(Environment.Variable sysp)
sysp - system propertypublic void addSyspropertyset(PropertySet sysp)
sysp - set of properties to addpublic void setFailonerror(boolean fail)
fail - if true fail the build when the command exits with a non
 zero returncodepublic void setDir(java.io.File d)
d - working directorypublic void setOutput(java.io.File out)
out - name of the output filepublic void setInput(java.io.File input)
input - name of the input filepublic void setInputString(java.lang.String inputString)
inputString - the string which is used as the input sourcepublic void setLogError(boolean logError)
logError - get in the ant log the messages coming from stderr
 in the case that fork = truepublic void setError(java.io.File error)
error - file getting the error streampublic void setOutputproperty(java.lang.String outputProp)
outputProp - property namepublic void setErrorProperty(java.lang.String errorProperty)
errorProperty - property namepublic void setMaxmemory(java.lang.String max)
max - max memory parameterpublic void setJVMVersion(java.lang.String value)
value - JVM versionpublic void addEnv(Environment.Variable var)
Will be ignored if we are not forking a new VM.
var - new environment variablepublic void setNewenvironment(boolean newenv)
Will be ignored if we are not forking a new VM.
newenv - if true, use a completely new environment.public void setAppend(boolean append)
append - if true, append output to existing filepublic void setTimeout(java.lang.Long value)
value - time out in millisecondspublic void addAssertions(Assertions asserts)
asserts - assertion setpublic void addConfiguredRedirector(RedirectorElement redirectorElement)
RedirectorElement to this task.
redirectorElement - RedirectorElement.protected void handleOutput(java.lang.String output)
handleOutput in class Taskoutput - a string of output on its way to the handlers
public int handleInput(byte[] buffer,
                       int offset,
                       int length)
                throws java.io.IOException
handleInput in class Taskbuffer - the buffer into which data is to be read.offset - the offset into the buffer at which data is stored.length - the amount of data to read
java.io.IOException - if the data cannot be readprotected void handleFlush(java.lang.String output)
handleFlush in class Taskoutput - string of output on its way to its handlersprotected void handleErrorOutput(java.lang.String output)
handleErrorOutput in class Taskoutput - string of stderrprotected void handleErrorFlush(java.lang.String output)
handleErrorFlush in class Taskoutput - string of stderrprotected void setupRedirector()
protected void run(java.lang.String classname,
                   java.util.Vector args)
            throws BuildException
classname - the name of the class to runargs - arguments for the class
BuildException - in case of IO Exception in the executionpublic void clearArgs()
protected ExecuteWatchdog createWatchdog()
                                  throws BuildException
BuildException - under unknown circumstancespublic CommandlineJava getCommandLine()
public CommandlineJava.SysProperties getSysProperties()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||