Home » apache-ant-1.8.1 » org.apache.tools » ant » taskdefs » [javadoc | source]
public class: Java [javadoc | source]

All Implemented Interfaces:

Direct Known Subclasses:
    StyleBook, Test

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 org.apache.tools.ant.Task:
target,  taskName,  taskType,  wrapper
Fields inherited from org.apache.tools.ant.ProjectComponent:
project,  location,  description
 public Java() 
 public Java(Task owner) 
    create a bound task
    owner - owner
Method from org.apache.tools.ant.taskdefs.Java Summary:
addAssertions,   addConfiguredRedirector,   addEnv,   addSysproperty,   addSyspropertyset,   checkConfiguration,   clearArgs,   createArg,   createBootclasspath,   createClasspath,   createJvmarg,   createPermissions,   createWatchdog,   execute,   executeJava,   executeJava,   getCommandLine,   getSysProperties,   handleErrorFlush,   handleErrorOutput,   handleFlush,   handleInput,   handleOutput,   maybeSetResultPropertyValue,   run,   setAppend,   setArgs,   setClassname,   setClasspath,   setClasspathRef,   setCloneVm,   setDir,   setError,   setErrorProperty,   setFailonerror,   setFork,   setInput,   setInputString,   setJVMVersion,   setJar,   setJvm,   setJvmargs,   setLogError,   setMaxmemory,   setNewenvironment,   setOutput,   setOutputproperty,   setResultProperty,   setSpawn,   setTimeout,   setupRedirector
Methods from org.apache.tools.ant.Task:
bindToOwner,   execute,   getOwningTarget,   getRuntimeConfigurableWrapper,   getTaskName,   getTaskType,   getWrapper,   handleErrorFlush,   handleErrorOutput,   handleFlush,   handleInput,   handleOutput,   init,   isInvalid,   log,   log,   log,   log,   markInvalid,   maybeConfigure,   perform,   reconfigure,   setOwningTarget,   setRuntimeConfigurableWrapper,   setTaskName,   setTaskType
Methods from org.apache.tools.ant.ProjectComponent:
clone,   getDescription,   getLocation,   getProject,   log,   log,   setDescription,   setLocation,   setProject
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tools.ant.taskdefs.Java Detail:
 public  void addAssertions(Assertions asserts) 
    Add assertions to enable in this program (if fork=true).
 public  void addConfiguredRedirector(RedirectorElement redirectorElement) 
    Add a RedirectorElement to this task.
 public  void addEnv(Variable var) 
    Add an environment variable.

    Will be ignored if we are not forking a new VM.

 public  void addSysproperty(Variable sysp) 
    Add a system property.
 public  void addSyspropertyset(PropertySet sysp) 
    Add a set of properties as system properties.
 protected  void checkConfiguration() throws BuildException 
    Check configuration.
 public  void clearArgs() 
    Clear out the arguments to this java task.
 public Argument createArg() 
    Add a command-line argument.
 public Path createBootclasspath() 
    Add a path to the bootclasspath.
 public Path createClasspath() 
    Add a path to the classpath.
 public Argument createJvmarg() 
    Adds a JVM argument.
 public Permissions createPermissions() 
    Set the permissions for the application run inside the same JVM.
 protected ExecuteWatchdog createWatchdog() throws BuildException 
    Create the Watchdog to kill a runaway process.
 public  void execute() throws BuildException 
    Do the execution.
 public int executeJava() throws BuildException 
    Do the execution and return a return code.
 protected int executeJava(CommandlineJava commandLine) 
    Execute the specified CommandlineJava.
 public CommandlineJava getCommandLine() 
    Accessor to the command line.
 public SysProperties getSysProperties() 
    Get the system properties of the command line.
 protected  void handleErrorFlush(String output) 
    Handle output sent to System.err and flush the stream.
 protected  void handleErrorOutput(String output) 
    Handle output sent to System.err.
 protected  void handleFlush(String output) 
    Pass output sent to System.out to specified output file.
 public int handleInput(byte[] buffer,
    int offset,
    int length) throws IOException 
    Handle an input request by this task.
 protected  void handleOutput(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(String classname,
    Vector args) throws BuildException 
    Executes the given classname with the given arguments as if it were a command line application.
 public  void setAppend(boolean append) 
    If true, append output to existing file.
 public  void setArgs(String s) 
    Deprecated: use nested arg instead. Set the command line arguments for the class.
 public  void setClassname(String s) throws BuildException 
    Set the Java class to execute.
 public  void setClasspath(Path s) 
    Set the classpath to be used when running the Java class.
 public  void setClasspathRef(Reference r) 
    Set the classpath to use by reference.
 public  void setCloneVm(boolean cloneVm) 
    If set, system properties will be copied to the cloned VM--as well as the bootclasspath unless you have explicitly specified a bootclaspath.

    Doesn't have any effect unless fork is true.

 public  void setDir(File d) 
    Set the working directory of the process.
 public  void setError(File error) 
    Set the File to which the error stream of the process is redirected.
 public  void setErrorProperty(String errorProperty) 
    Set the property name whose value should be set to the error of the process.
 public  void setFailonerror(boolean fail) 
    If true, then fail if the command exits with a returncode other than zero.
 public  void setFork(boolean s) 
    If true, execute in a new VM.
 public  void setInput(File input) 
    Set the input to use for the task.
 public  void setInputString(String inputString) 
    Set the string to use as input.
 public  void setJVMVersion(String value) 
    Set the JVM version.
 public  void setJar(File jarfile) throws BuildException 
    Set the location of the JAR file to execute.
 public  void setJvm(String s) 
    Set the command used to start the VM (only if forking).
 public  void setJvmargs(String s) 
    Set the command line arguments for the JVM.
 public  void setLogError(boolean logError) 
    Set whether error output of exec is logged. This is only useful when output is being redirected and error output is desired in the Ant log.
 public  void setMaxmemory(String max) 
    Corresponds to -mx or -Xmx depending on VM version.
 public  void setNewenvironment(boolean newenv) 
    If true, use a completely new environment.

    Will be ignored if we are not forking a new VM.

 public  void setOutput(File out) 
    Set the File to which the output of the process is redirected.
 public  void setOutputproperty(String outputProp) 
    Set the property name whose value should be set to the output of the process.
 public  void setResultProperty(String resultProperty) 
    Set the name of the property in which the return code of the command should be stored. Only of interest if failonerror=false.
 public  void setSpawn(boolean spawn) 
    Set whether or not you want the process to be spawned; default is not spawned.
 public  void setTimeout(Long value) 
    Set the 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.