Package org.apache.commons.launcher
Class LaunchCommand
- java.lang.Object
-
- org.apache.commons.launcher.LaunchCommand
-
public class LaunchCommand extends java.lang.Object
A class that represents the holds the various argument types that are used in a Java command. In addition, it holds many of the flags that are used by theLaunchTask
class when executing a JVM process.- Author:
- Patrick Luby
-
-
Constructor Summary
Constructors Constructor Description LaunchCommand()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getAppendoutput()
Get the appendOutput flag.java.util.ArrayList
getArgs()
Get the list of nested arg elements.java.lang.String
getClassname()
Get the class name.java.lang.String
getClasspath()
Get the classpath.boolean
getDebug()
Get the debug flag.boolean
getDisplayminimizedwindow()
Get the displayMinimizedWindow flag.boolean
getDisposeminimizedwindow()
Get the disposeMinimizedWindow flag.boolean
getFailonerror()
Get the failOnError flag.java.util.ArrayList
getJvmargs()
Get the list of nested jvmarg elements.java.io.File
getMinimizedwindowicon()
Get the icon file for the minimized window that will be displayed in the Windows taskbar.java.lang.String
getMinimizedwindowtitle()
Get the title for the minimized window that will be displayed in the Windows taskbar.java.io.File
getOutput()
Get the file that the child JVM's System.out and System.err will be redirected to.boolean
getPrint()
Get the print flag.boolean
getRedirectoutput()
Get the redirect flag.boolean
getRequiretools()
Get the requireTools flag.java.util.HashMap
getSysproperties()
Get the list of nested sysproperty elements.boolean
getUsesystemin()
Get the useSystemIn flag.boolean
getWaitforchild()
Get the waitForChild flag.void
setAppendoutput(boolean appendOutput)
Set the appendOutput flag.void
setArgs(java.util.ArrayList args)
Set the list of nested arg elements.void
setClassname(java.lang.String mainClassName)
Set the class name.void
setClasspath(java.lang.String classpath)
Set the classpath.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
setJvmargs(java.util.ArrayList jvmArgs)
Set the list of nested jvmarg elements.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
setSysproperties(java.util.HashMap sysProperties)
Set the list of nested sysproperty elements.void
setUsesystemin(boolean useSystemIn)
Set the useSystemIn flag.void
setWaitforchild(boolean waitForChild)
Set the waitForChild flag.
-
-
-
Method Detail
-
getClassname
public java.lang.String getClassname()
Get the class name.- Returns:
- the class to execute
main(String[])
-
getClasspath
public java.lang.String getClasspath()
Get the classpath.- Returns:
- the classpath
-
getDebug
public boolean getDebug()
Get the debug flag.- Returns:
- the debug flag
-
getDisplayminimizedwindow
public boolean getDisplayminimizedwindow()
Get the displayMinimizedWindow flag.- Returns:
- the displayMinimizedWindow flag
-
getDisposeminimizedwindow
public boolean getDisposeminimizedwindow()
Get the disposeMinimizedWindow flag.- Returns:
- the disposeMinimizedWindow flag
-
getFailonerror
public boolean getFailonerror()
Get the failOnError flag.- Returns:
- the failOnError flag
-
getMinimizedwindowtitle
public java.lang.String getMinimizedwindowtitle()
Get the title for the minimized window that will be displayed in the Windows taskbar.- Returns:
- the title to set for any minimized window that is displayed in the Windows taskbar
-
getMinimizedwindowicon
public java.io.File getMinimizedwindowicon()
Get the icon file for the minimized window that will be displayed in the Windows taskbar.- Returns:
- the icon file to use for any minimized window that is displayed in the Windows taskbar
-
getOutput
public java.io.File getOutput()
Get the file that the child JVM's System.out and System.err will be redirected to.- Returns:
- the File to redirect System.out and System.err to
-
getAppendoutput
public boolean getAppendoutput()
Get the appendOutput flag.- Returns:
- the appendOutput flag
-
getRedirectoutput
public boolean getRedirectoutput()
Get the redirect flag.- Returns:
- the redirect flag
-
getArgs
public java.util.ArrayList getArgs()
Get the list of nested arg elements.- Returns:
- the list of
String
objects
-
getJvmargs
public java.util.ArrayList getJvmargs()
Get the list of nested jvmarg elements.- Returns:
- the list of
String
objects
-
getPrint
public boolean getPrint()
Get the print flag.- Returns:
- the print flag
-
getRequiretools
public boolean getRequiretools()
Get the requireTools flag.- Returns:
- the requireTools flag
-
getSysproperties
public java.util.HashMap getSysproperties()
Get the list of nested sysproperty elements.- Returns:
- the
String
objects
-
getUsesystemin
public boolean getUsesystemin()
Get the useSystemIn flag.- Returns:
- the useSystemIn flag
-
getWaitforchild
public boolean getWaitforchild()
Get the waitForChild flag.- Returns:
- the waitForChild flag
-
setPrint
public void setPrint(boolean print)
Set the print flag.- Parameters:
print
- the print flag
-
setRequiretools
public void setRequiretools(boolean requireTools)
Set the requireTools flag.- Parameters:
requireTools
- the requireTools flag
-
setUsesystemin
public void setUsesystemin(boolean useSystemIn)
Set the useSystemIn flag. Setting this flag to false will cause this task to not read System.in. This will cause the child JVM to never receive any bytes when it reads System.in. Setting this flag to false is useful in some Unix environments where processes cannot be put in the background when they read System.in.- Parameters:
useSystemIn
- the useSystemIn flag
-
setWaitforchild
public void setWaitforchild(boolean waitForChild)
Set the waitForChild flag. Setting this flag to true will cause this task to wait for the child JVM to finish executing before the task completes. Setting this flag to false will cause this task to complete immediately after it starts the execution of the child JVM. Setting it false emulates the "&" background operator in most Unix shells and is most of set to false when launching server or GUI applications.- Parameters:
waitForChild
- the waitForChild flag
-
setClassname
public void setClassname(java.lang.String mainClassName)
Set the class name.- Parameters:
mainClassName
- the class to executemain(String[])
-
setClasspath
public void setClasspath(java.lang.String classpath)
Set the classpath.- Parameters:
classpath
- the classpath
-
setDebug
public void setDebug(boolean debug)
Set the debug flag.- Parameters:
debug
- the debug flag
-
setDisplayminimizedwindow
public void setDisplayminimizedwindow(boolean displayMinimizedWindow)
Set the displayMinimizedWindow flag. Note that this flag has no effect on non-Windows platforms. On Windows platform, setting this flag to true will cause a minimized window to be displayed in the Windows task bar while the child process is executing. This flag is usually set to true for server applications that also have their "waitForChild" attribute set to false via thesetWaitforchild(boolean)
method.- Parameters:
displayMinimizedWindow
- true if a minimized window should be displayed in the Windows task bar while the child process is executing
-
setDisposeminimizedwindow
public void setDisposeminimizedwindow(boolean disposeMinimizedWindow)
Set the disposeMinimizedWindow flag. Note that this flag has no effect on non-Windows platforms. On Windows platform, setting this flag to true will cause any minimized window that is display by setting the "displayMinimizedWindow" attribute to true via thesetDisplayminimizedwindow(boolean)
to be automatically disposed of when the child JVM'smain(String[])
returns. This flag is normally used for applications that don't explicitly callSystem.exit(int)
. If an application does not explicitly callSystem.exit(int)
, an minimized windows need to be disposed of for the child JVM to exit.- Parameters:
disposeMinimizedWindow
- true if a minimized window in the Windows taskbar should be automatically disposed of after the child JVM'smain(String[])
returns
-
setFailonerror
public void setFailonerror(boolean failOnError)
Set the failOnError flag.- Parameters:
failOnError
- the failOnError flag
-
setMinimizedwindowtitle
public void setMinimizedwindowtitle(java.lang.String minimizedWindowTitle)
Set the title for the minimized window that will be displayed in the Windows taskbar. Note that this property has no effect on non-Windows platforms.- Parameters:
minimizedWindowTitle
- the title to set for any minimized window that is displayed in the Windows taskbar
-
setMinimizedwindowicon
public void setMinimizedwindowicon(java.io.File minimizedWindowIcon)
Set the icon file for the minimized window that will be displayed in the Windows taskbar. Note that this property has no effect on non-Windows platforms.- Parameters:
minimizedWindowIcon
- the icon file to use for any minimized window that is displayed in the Windows taskbar
-
setOutput
public void setOutput(java.io.File outputFile)
Set the file that the child JVM's System.out and System.err will be redirected to. Output will only be redirected if the redirect flag is set to true via thesetRedirectoutput(boolean)
method.- Parameters:
outputFile
- a File to redirect System.out and System.err to
-
setAppendoutput
public void setAppendoutput(boolean appendOutput)
Set the appendOutput flag. Setting this flag to true will cause the child JVM to append System.out and System.err to the file specified by thesetOutput(File)
method. Setting this flag to false will cause the child to overwrite the file.- Parameters:
appendOutput
- true if output should be appended to the output file
-
setArgs
public void setArgs(java.util.ArrayList args)
Set the list of nested arg elements.- Parameters:
args
- a list ofString
objects
-
setJvmargs
public void setJvmargs(java.util.ArrayList jvmArgs)
Set the list of nested jvmarg elements.- Parameters:
jvmArgs
- a list ofString
objects
-
setSysproperties
public void setSysproperties(java.util.HashMap sysProperties)
Set the list of nested sysproperty elements.- Parameters:
sysProperties
- a map ofString
objects
-
setRedirectoutput
public void setRedirectoutput(boolean redirect)
Set the redirect flag. Setting this flag to true will cause the child JVM's System.out and System.err to be redirected to file set using thesetOutput(File)
method. Setting this flag to false will cause no redirection.- Parameters:
redirect
- true if System.out and System.err should be redirected
-
-