|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.ProjectComponent | +--org.apache.tools.ant.Task | +--org.apache.commons.launcher.LaunchTask
A class that eliminates the need for a batch or shell script to launch a Java class. Some situations where elimination of a batch or shell script may be desirable are:
java.endorsed.dirs
when running with JDK 1.4.
Field Summary | |
static java.lang.String |
ARG_PROP_NAME
The argument property name. |
static java.lang.String |
LOCALE_COUNTRY_PROP_NAME
The default locale's country property name. |
static java.lang.String |
LOCALE_LANGUAGE_PROP_NAME
The default locale's language property name. |
static java.lang.String |
TASK_NAME
The name of this task. |
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 | |
LaunchTask()
|
Method Summary | |
void |
addArg(ConditionalArgument arg)
Add a nested arg element. |
void |
addArgset(ArgumentSet set)
Add a nested argset element. |
void |
addJvmarg(ConditionalArgument jvmArg)
Add a nested jvmarg element. |
void |
addJvmargset(JVMArgumentSet set)
Add a nested jvmargset element. |
void |
addSysproperty(ConditionalVariable var)
Add a nested sysproperty element. |
void |
addSyspropertyset(SysPropertySet set)
Add a nested syspropertyset element. |
org.apache.tools.ant.types.Path |
createClasspath()
Create a nested classpath element. |
org.apache.tools.ant.types.Path |
createFilterclasspath()
Create a nested filter classpath element. |
void |
execute()
Construct a Java command and execute it using the settings that Ant parsed from the Launcher's XML file. |
static LaunchTask[] |
getExecutingTasks()
Get the instances of this class that are executing synchronous child processes. |
void |
kill()
Kill the currently executing synchronous child process. |
void |
setAppendoutput(boolean appendOutput)
Set the appendOutput flag. |
void |
setClassname(java.lang.String mainClassName)
Set the class name. |
void |
setClasspath(org.apache.tools.ant.types.Path classpath)
Set the classpath. |
void |
setClasspathref(org.apache.tools.ant.types.Reference ref)
Adds a reference to a classpath defined elsewhere. |
void |
setDebug(boolean debug)
Set the debug flag. |
void |
setDisplayminimizedwindow(boolean displayMinimizedWindow)
Set the displayMinimizedWindow flag. |
void |
setDisposeminimizedwindow(boolean disposeMinimizedWindow)
Set the disposeMinimizedWindow flag. |
void |
setFailonerror(boolean failOnError)
Set the failOnError flag. |
void |
setFilterclassname(java.lang.String filterClassName)
Set the filter class name. |
void |
setFilterclasspath(org.apache.tools.ant.types.Path filterClasspath)
Set the filter class' classpath. |
void |
setMinimizedwindowicon(java.io.File minimizedWindowIcon)
Set the icon file for the minimized window that will be displayed in the Windows taskbar. |
void |
setMinimizedwindowtitle(java.lang.String minimizedWindowTitle)
Set the title for the minimized window that will be displayed in the Windows taskbar. |
void |
setOutput(java.io.File outputFile)
Set the file that the child JVM's System.out and System.err will be redirected to. |
void |
setPrint(boolean print)
Set the print flag. |
void |
setRedirectoutput(boolean redirect)
Set the redirect flag. |
void |
setRequiretools(boolean requireTools)
Set the requireTools flag. |
void |
setUseargs(boolean useArgs)
Set the useArgs flag. |
void |
setUsesystemin(boolean useSystemIn)
Set the useSystemIn flag. |
void |
setWaitforchild(boolean waitForChild)
Set the waitForChild flag. |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, 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 |
Field Detail |
public static final java.lang.String ARG_PROP_NAME
public static final java.lang.String LOCALE_LANGUAGE_PROP_NAME
public static final java.lang.String LOCALE_COUNTRY_PROP_NAME
public static final java.lang.String TASK_NAME
Constructor Detail |
public LaunchTask()
Method Detail |
public static LaunchTask[] getExecutingTasks()
public void addArg(ConditionalArgument arg)
execute()
method.arg
- the arg elementpublic void addArgset(ArgumentSet set)
set
- the argset elementpublic void addJvmarg(ConditionalArgument jvmArg)
execute()
method.jvmArg
- the jvmarg elementpublic void addJvmargset(JVMArgumentSet set)
set
- the jvmargset elementpublic void addSysproperty(ConditionalVariable var)
execute()
method.var
- the sysproperty elementpublic void addSyspropertyset(SysPropertySet set)
set
- the syspropertyset elementpublic org.apache.tools.ant.types.Path createClasspath()
public org.apache.tools.ant.types.Path createFilterclasspath()
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- if there is a configuration or other errorpublic void kill()
ParentListener.run()
method, will invoke
System#exit(int)
. This approach is used because it allows the
child process to execute its shutdown hooks. Process#destroy()
is not used because it will forcefully terminate the child process on
Windows without executing child process' shutdown hooks.public void setUseargs(boolean useArgs)
Launcher.start(String[])
method to the arguments
passed to the child JVM.useArgs
- the useArgs flagpublic void setUsesystemin(boolean useSystemIn)
useSystemIn
- the useSystemIn flagpublic void setWaitforchild(boolean waitForChild)
waitForChild
- the waitForChild flagpublic void setClassname(java.lang.String mainClassName)
mainClassName
- the class to execute main(String[])
public void setClasspath(org.apache.tools.ant.types.Path classpath)
classpath
- the classpathpublic void setClasspathref(org.apache.tools.ant.types.Reference ref)
ref
- reference to the classpathpublic void setDebug(boolean debug)
debug
- the debug flagpublic void setDisplayminimizedwindow(boolean displayMinimizedWindow)
setWaitforchild(boolean)
method.displayMinimizedWindow
- true if a minimized window should be
displayed in the Windows task bar while the child process is executingpublic void setDisposeminimizedwindow(boolean disposeMinimizedWindow)
setDisplayminimizedwindow(boolean)
to be automatically
disposed of when the child JVM's main(String[])
returns.
This flag is normally used for applications that don't explicitly call
System#exit(int)
. If an application does not explicitly call
System#exit(int)
, an minimized windows need to be disposed of
for the child JVM to exit.disposeMinimizedWindow
- true if a minimized window in the Windows
taskbar should be automatically disposed of after the child JVM's
main(String[])
returnspublic void setFailonerror(boolean failOnError)
failOnError
- true if the launch process should stop if the child
JVM returns an exit value other than 0public void setFilterclassname(java.lang.String filterClassName)
filterClassName
- the class that implements the
LaunchFilter
interfacepublic void setFilterclasspath(org.apache.tools.ant.types.Path filterClasspath)
classpath
- the classpath for the filter classpublic void setMinimizedwindowtitle(java.lang.String minimizedWindowTitle)
minimizedWindowTitle
- the title to set for any minimized window
that is displayed in the Windows taskbarpublic void setMinimizedwindowicon(java.io.File minimizedWindowIcon)
minimizedWindowIcon
- the icon file to use for any minimized window
that is displayed in the Windows taskbarpublic void setOutput(java.io.File outputFile)
setRedirectoutput(boolean)
method.outputFile
- a File to redirect System.out and System.err topublic void setPrint(boolean print)
System#out
.print
- the print flagpublic void setAppendoutput(boolean appendOutput)
setOutput(File)
method. Setting this flag to false will cause
the child to overwrite the file.appendOutput
- true if output should be appended to the output filepublic void setRedirectoutput(boolean redirect)
setOutput(File)
method. Setting this flag to false will
cause no redirection.redirect
- true if System.out and System.err should be redirectedpublic void setRequiretools(boolean requireTools)
redirect
- true if a JDK is required and false if only a JRE
is required
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |