|
||||||||||
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 |
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 |
addEnv(Environment.Variable var)
Adds an environment variable. |
void |
addSysproperty(Environment.Variable sysp)
Adds a system property. |
void |
clearArgs()
Clear out the arguments to this java task. |
Commandline.Argument |
createArg()
Adds a command-line argument. |
Path |
createClasspath()
Adds a path to the classpath. |
Commandline.Argument |
createJvmarg()
Adds a JVM argument. |
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. |
protected void |
handleErrorOutput(java.lang.String line)
Pass output sent to System.err to specified output file. |
protected void |
handleOutput(java.lang.String line)
Pass output sent to System.out to specified output file. |
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 |
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 |
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 not 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 |
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 |
setTimeout(java.lang.Long value)
Timeout in milliseconds after which the process will be killed. |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
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 |
Constructor Detail |
public Java()
Method Detail |
public void execute() throws BuildException
execute
in class Task
BuildException
- if something goes wrong with the buildpublic int executeJava() throws BuildException
BuildException
public void setClasspath(Path s)
s
- an Ant Path object containing the classpath.public Path createClasspath()
public void setClasspathRef(Reference r)
public void setJar(java.io.File jarfile) throws BuildException
BuildException
public void setClassname(java.lang.String s) throws BuildException
BuildException
public void setArgs(java.lang.String s)
public Commandline.Argument createArg()
public void setFork(boolean s)
public void setJvmargs(java.lang.String s)
public Commandline.Argument createJvmarg()
public void setJvm(java.lang.String s)
public void addSysproperty(Environment.Variable sysp)
public void setFailonerror(boolean fail)
public void setDir(java.io.File d)
public void setOutput(java.io.File out)
public void setMaxmemory(java.lang.String max)
public 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.
public void setNewenvironment(boolean newenv)
Will be ignored if we are not forking a new VM.
public void setAppend(boolean append)
public void setTimeout(java.lang.Long value)
protected void handleOutput(java.lang.String line)
handleOutput
in class Task
line
- The line of output to log. Should not be null
.protected void handleErrorOutput(java.lang.String line)
handleErrorOutput
in class Task
line
- The error line to log. Should not be null
.protected void run(java.lang.String classname, java.util.Vector args) throws BuildException
BuildException
public void clearArgs()
protected ExecuteWatchdog createWatchdog() throws BuildException
BuildException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |