Class Exec

  extended by

public final class Exec
extends java.lang.Object

Runtime.exec made simple

Method Summary
static int exec(java.lang.String[] cmdarray, java.lang.String[] envp, int timeout, stdin, stdout, stderr)
static int execWithMasterPassword(java.lang.String[] cmdarray, java.lang.String[] envp, int timeout, stdout, stderr)
          Exec the given command adding the master password info if necessary.
static void main(java.lang.String[] args)
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail


public static int exec(java.lang.String[] cmdarray,
                       java.lang.String[] envp,
                       int timeout,


public static int execWithMasterPassword(java.lang.String[] cmdarray,
                                         java.lang.String[] envp,
                                         int timeout,
Exec the given command adding the master password info if necessary. Specifically, the -masterPasswordNoPrompt option is appended to the cmdarray array, and the master password is fetched and passed to the stdin of the exec call.

Two limitations:

(1) Original command that requres input data is not supported. In fact, there is no provision for the caller to provide the stdin (2) The -masterPasswordNoPrompt is appended at the end of the command line array, so commands that pipe or redirect output such as {"tableedit", "-script", "scriptfile", ">", "outfile"} will become {"tableedit", "-script", "scriptfile", ">", "outfile", "-masterPasswordNoPrompt"), which clearly won't work.

cmdarray - the command to execute, must be non null and not empty
envp - the environment to execute, can be mull.
timeout - timeout, a value of timeout will timeout immediately, negative value means no timeout (wait forever)
stdout - the stdout
stderr - the stderr
the status of the exec'ed process. A value of 0 indicates normal termination.
Throws: - if an I/O error occurs


public static void main(java.lang.String[] args)

AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.