Class DefaultExecutor

  • All Implemented Interfaces:
    Executor
    Direct Known Subclasses:
    DaemonExecutor

    public class DefaultExecutor
    extends java.lang.Object
    implements Executor
    The default class to start a subprocess. The implementation allows to
    • set a current working directory for the subprocess
    • provide a set of environment variables passed to the subprocess
    • capture the subprocess output of stdout and stderr using an ExecuteStreamHandler
    • kill long-running processes using an ExecuteWatchdog
    • define a set of expected exit values
    • terminate any started processes when the main process is terminating using a ProcessDestroyer
    The following example shows the basic usage:
     Executor exec = new DefaultExecutor();
     CommandLine cl = new CommandLine("ls -l");
     int exitvalue = exec.execute(cl);
     
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultExecutor()
      Default constructor creating a default PumpStreamHandler and sets the working directory of the subprocess to the current working directory.