edu.cmu.sphinx.tools.gui.util
Class SysCommandExecutor

java.lang.Object
  extended by edu.cmu.sphinx.tools.gui.util.SysCommandExecutor

public class SysCommandExecutor
extends java.lang.Object

This class is used to execute command line at from Java runtime Usage of following class ...


                SysCommandExecutor cmdExecutor = SysCommandExecutor.getInstance();              
                int exitStatus = cmdExecutor.runCommand(commandLine);
 
                String cmdError = cmdExecutor.getCommandError();
                String cmdOutput = cmdExecutor.getCommandOutput(); 
 


Method Summary
 java.lang.String getCommandError()
          get the error message after command execution
 java.lang.String getCommandOutput()
          get the output of command
static SysCommandExecutor getInstance()
          Get reference to the SysCommandExecutor
 int runCommand(java.lang.String commandLine)
          execute the command
 void setEnvironmentVar(java.lang.String name, java.lang.String value)
           
 void setWorkingDirectory(java.lang.String workingDirectory)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SysCommandExecutor getInstance()
Get reference to the SysCommandExecutor

Returns:
SysCommandExecutor

setWorkingDirectory

public void setWorkingDirectory(java.lang.String workingDirectory)

setEnvironmentVar

public void setEnvironmentVar(java.lang.String name,
                              java.lang.String value)

getCommandOutput

public java.lang.String getCommandOutput()
get the output of command


getCommandError

public java.lang.String getCommandError()
get the error message after command execution


runCommand

public int runCommand(java.lang.String commandLine)
               throws java.lang.Exception
execute the command

Parameters:
commandLine - command
Returns:
Exit status of command
Throws:
java.lang.Exception