org.apache.tools.ant.taskdefs
Class Java

java.lang.Object
  |
  +--org.apache.tools.ant.Task
        |
        +--org.apache.tools.ant.taskdefs.Java
Direct Known Subclasses:
StyleBook, Test

public class Java
extends Task

This task acts as a loader for java applications but allows to use the same JVM for the called application thus resulting in much faster operation.

Author:
Stefano Mazzocchi stefano@apache.org, Stefan Bodewig

Fields inherited from class org.apache.tools.ant.Task
description, location, project, target, taskName, taskType, wrapper
 
Constructor Summary
Java()
           
 
Method Summary
 void addSysproperty(Environment.Variable sysp)
          Add a nested sysproperty element.
 void clearArgs()
          Clear out the arguments to this java task.
 Commandline.Argument createArg()
          Creates a nested arg element.
 Path createClasspath()
          Creates a nested classpath element
 Commandline.Argument createJvmarg()
          Creates a nested jvmarg element.
 void execute()
          Do the execution.
 int executeJava()
          Do the execution and return a return code.
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 setArgs(java.lang.String s)
          Set the command line arguments for the class.
 void setClassname(java.lang.String s)
          Set the class name.
 void setClasspath(Path s)
          Set the classpath to be used for this compilation.
 void setClasspathRef(Reference r)
          Adds a reference to a CLASSPATH defined elsewhere.
 void setDir(java.io.File d)
          The working directory of the process
 void setFailonerror(boolean fail)
          Throw a BuildException if process returns non 0.
 void setFork(boolean s)
          Set the forking flag.
 void setJvm(java.lang.String s)
          Set the command used to start the VM (only if fork==false).
 void setJvmargs(java.lang.String s)
          Set the command line arguments for the JVM.
 void setMaxmemory(java.lang.String max)
          -mx or -Xmx depending on VM version
 void setOutput(java.io.File out)
          File the output of the process is redirected to.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Java

public Java()
Method Detail

execute

public void execute()
             throws BuildException
Do the execution.
Overrides:
execute in class Task
Following copied from class: org.apache.tools.ant.Task
Throws:
BuildException - if someting goes wrong with the build

executeJava

public int executeJava()
                throws BuildException
Do the execution and return a return code.
Returns:
the return code from the execute java class if it was executed in a separate VM (fork = "yes").

setClasspath

public void setClasspath(Path s)
Set the classpath to be used for this compilation.

createClasspath

public Path createClasspath()
Creates a nested classpath element

setClasspathRef

public void setClasspathRef(Reference r)
Adds a reference to a CLASSPATH defined elsewhere.

setClassname

public void setClassname(java.lang.String s)
Set the class name.

setArgs

public void setArgs(java.lang.String s)
Set the command line arguments for the class.

createArg

public Commandline.Argument createArg()
Creates a nested arg element.

setFork

public void setFork(boolean s)
Set the forking flag.

setJvmargs

public void setJvmargs(java.lang.String s)
Set the command line arguments for the JVM.

createJvmarg

public Commandline.Argument createJvmarg()
Creates a nested jvmarg element.

setJvm

public void setJvm(java.lang.String s)
Set the command used to start the VM (only if fork==false).

addSysproperty

public void addSysproperty(Environment.Variable sysp)
Add a nested sysproperty element.

setFailonerror

public void setFailonerror(boolean fail)
Throw a BuildException if process returns non 0.

setDir

public void setDir(java.io.File d)
The working directory of the process

setOutput

public void setOutput(java.io.File out)
File the output of the process is redirected to.

setMaxmemory

public void setMaxmemory(java.lang.String max)
-mx or -Xmx depending on VM version

run

protected void run(java.lang.String classname,
                   java.util.Vector args)
            throws BuildException
Executes the given classname with the given arguments as it was a command line application.

clearArgs

public void clearArgs()
Clear out the arguments to this java task.


Copyright ? 2000 Apache Software Foundation. All Rights Reserved.