org.openjump.core.ui.plugin.customize
Class CmdRunner

java.lang.Object
  extended by org.openjump.core.ui.plugin.customize.CmdRunner

public class CmdRunner
extends java.lang.Object

Author:
Larry Becker This class launches exernal programs with command line options. Stack traces are printed when exceptions occur.

Constructor Summary
CmdRunner()
           
 
Method Summary
static void addEnviroment(java.lang.String enviromentVariable, java.lang.String value)
           
static java.lang.String getOsName()
           
static boolean isWindows()
           
 void run(java.lang.String[] runStr, boolean runAndWait)
          Essentialy a wrapper for Runtime.getRuntime().exec() that waits and catches exceptions.
 void run(java.lang.String commandLine, char delimiter)
          Run command line, wait and catch exceptions
 java.lang.String[] runAndGetOutput(java.lang.String command, char delimiter)
           
 void runLater(java.lang.String commandLine, char delimiter)
          Run command line and do not wait for process to end
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmdRunner

public CmdRunner()
Method Detail

run

public void run(java.lang.String[] runStr,
                boolean runAndWait)
Essentialy a wrapper for Runtime.getRuntime().exec() that waits and catches exceptions.

Parameters:
runStr -
runAndWait - True - wait for process to end, False - do not wait for process to end

addEnviroment

public static void addEnviroment(java.lang.String enviromentVariable,
                                 java.lang.String value)

runLater

public void runLater(java.lang.String commandLine,
                     char delimiter)
Run command line and do not wait for process to end

Parameters:
commandLine - - command to run - must be executable at system command line.
delimiter - - character used to delimit parameters - must not occur inside parameters.

run

public void run(java.lang.String commandLine,
                char delimiter)
Run command line, wait and catch exceptions

Parameters:
commandLine - - command to run - must be executable at system command line.
delimiter - - character used to delimit parameters - must not occur inside parameters.

runAndGetOutput

public java.lang.String[] runAndGetOutput(java.lang.String command,
                                          char delimiter)
Parameters:
command - - (full) command to run - must be executable at system command line.
delimiter - - character used to delimit parameters - must not occur inside parameters.
Returns:
output of commmand or null if no ouput produced.

getOsName

public static java.lang.String getOsName()

isWindows

public static boolean isWindows()