|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
net.jtools.ant.JavaLauncher
public class JavaLauncher
Launcher for Java applications. Allows use of the same JVM for the called application thus resulting in much faster operation.
Field Summary | |
---|---|
protected boolean |
append
|
protected CommandlineJava |
cmdl
|
protected File |
dir
|
protected Environment |
env
|
protected boolean |
failOnError
|
protected boolean |
fork
|
protected boolean |
newEnvironment
|
protected File |
out
|
protected PrintStream |
outStream
|
protected Long |
timeout
|
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 | |
---|---|
JavaLauncher()
|
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()
|
void |
executeDirect()
Do the execution. |
void |
executeForked()
|
int |
executeJava()
Do the execution and return a return code. |
void |
executeMain()
|
protected void |
handleErrorFlush(String line)
Pass output sent to System.err to specified output file. |
protected void |
handleErrorOutput(String line)
Pass output sent to System.err to specified output file. |
protected void |
handleFlush(String line)
Pass output sent to System.out to specified output file. |
protected void |
handleOutput(String line)
Pass output sent to System.out to specified output file. |
protected void |
run(String classname,
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(String s)
Deprecated: use nested arg instead. |
void |
setClassname(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(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(File jarfile)
The location of the JAR file to execute. |
void |
setJvm(String s)
Set the command used to start the VM (only if not forking). |
void |
setJvmargs(String s)
Set the command line arguments for the JVM. |
void |
setJVMVersion(String value)
Sets the JVM version. |
void |
setMaxmemory(String max)
Corresponds to -mx or -Xmx depending on VM version. |
void |
setNewenvironment(boolean newenv)
If true, use a completely new environment. |
void |
setOutput(File out)
File the output of the process is redirected to. |
void |
setTimeout(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, getTaskType, getWrapper, handleInput, 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 boolean append
protected CommandlineJava cmdl
protected File dir
protected Environment env
protected boolean failOnError
protected boolean fork
protected boolean newEnvironment
protected File out
protected PrintStream outStream
protected Long timeout
Constructor Detail |
---|
public JavaLauncher()
Method Detail |
---|
public void addEnv(Environment.Variable var)
Will be ignored if we are not forking a new VM.
public void addSysproperty(Environment.Variable sysp)
public void clearArgs()
public Commandline.Argument createArg()
public Path createClasspath()
public Commandline.Argument createJvmarg()
protected ExecuteWatchdog createWatchdog() throws BuildException
BuildException
public void execute() throws BuildException
execute
in class Task
BuildException
public void executeDirect() throws BuildException
BuildException
public void executeForked() throws BuildException
BuildException
public int executeJava() throws BuildException
BuildException
public void executeMain() throws BuildException
BuildException
protected void handleErrorFlush(String line)
handleErrorFlush
in class Task
protected void handleErrorOutput(String line)
handleErrorOutput
in class Task
protected void handleFlush(String line)
handleFlush
in class Task
protected void handleOutput(String line)
handleOutput
in class Task
protected void run(String classname, Vector args) throws BuildException
BuildException
public void setAppend(boolean append)
public void setArgs(String s)
public void setClassname(String s) throws BuildException
BuildException
public void setClasspath(Path s)
s
- an Ant Path object containing the classpath.public void setClasspathRef(Reference r)
public void setDir(File d)
public void setFailonerror(boolean fail)
public void setFork(boolean s)
public void setJar(File jarfile) throws BuildException
BuildException
public void setJvm(String s)
public void setJvmargs(String s)
public void setJVMVersion(String value)
value
- JVM versionpublic void setMaxmemory(String max)
public void setNewenvironment(boolean newenv)
Will be ignored if we are not forking a new VM.
public void setOutput(File out)
public void setTimeout(Long value)
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |