Package org.apache.commons.exec.launcher
Class CommandLauncherImpl
java.lang.Object
org.apache.commons.exec.launcher.CommandLauncherImpl
- All Implemented Interfaces:
- CommandLauncher
- Direct Known Subclasses:
- CommandLauncherProxy,- Java13CommandLauncher
A command launcher for a particular JVM/OS platform. This class is a general purpose command launcher which can only launch commands in the current working
 directory.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionexec(CommandLine cmd, Map<String, String> env) Executes the given command in a new process.abstract ProcessExecutes the given command in a new process, in the given working directory.booleanisFailure(int exitValue) Tests whetherexitValuesignals a failure on the current system (OS specific).Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.exec.launcher.CommandLauncherexec
- 
Constructor Details- 
CommandLauncherImplpublic CommandLauncherImpl()Constructs a new instance.
 
- 
- 
Method Details- 
execDescription copied from interface:CommandLauncherExecutes the given command in a new process.- Specified by:
- execin interface- CommandLauncher
- Parameters:
- cmd- The command to execute.
- env- The environment for the new process. If null, the environment of the current process is used.
- Returns:
- the newly created process.
- Throws:
- IOException- if attempting to run a command in a specific directory.
 
- 
execpublic abstract Process exec(CommandLine cmd, Map<String, String> env, File workingDir) throws IOExceptionDescription copied from interface:CommandLauncherExecutes the given command in a new process, in the given working directory.- Specified by:
- execin interface- CommandLauncher
- Parameters:
- cmd- The command to execute.
- env- The environment for the new process. If null, the environment of the current process is used.
- workingDir- The directory to start the command in. If null, the current directory is used.
- Returns:
- the newly created process.
- Throws:
- IOException- if trying to change directory.
 
- 
isFailureDescription copied from interface:CommandLauncherTests whetherexitValuesignals a failure on the current system (OS specific).Note that this method relies on the conventions of the OS, it will return false results if the application you are running doesn't follow these conventions. One notable exception is the Java VM provided by HP for OpenVMS - it will return 0 if successful (like on any other platform), but this signals a failure on OpenVMS. So if you execute a new Java VM on OpenVMS, you cannot trust this method. - Specified by:
- isFailurein interface- CommandLauncher
- Parameters:
- exitValue- the exit value (return code) to be checked.
- Returns:
- trueif- exitValuesignals a failure.
- See Also:
 
 
-