|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmylib.Exec
public class Exec
A class that eases the pain of running external processes from applications. Lets you run a program three ways:
javac
followed by
java
).
ls
.
Exec.exec("/usr/ucb/lpr Some-File");
Exec.execWait("/usr/local/bin/javac Foo.java"); Exec.execWait("/usr/local/bin/java Foo");
Exec.execPrint("/usr/bin/ls -al");
Field Summary | |
---|---|
private static boolean |
verbose
|
Constructor Summary | |
---|---|
Exec()
|
Method Summary | |
---|---|
static boolean |
exec(java.lang.String command)
Starts a process to execute the command. |
private static boolean |
exec(java.lang.String command,
boolean printResults,
boolean wait)
|
static boolean |
execPrint(java.lang.String command)
Starts a process to execute the command. |
static boolean |
execWait(java.lang.String command)
Starts a process to execute the command. |
static boolean |
getVerbose()
Will Exec print status messages? |
private static void |
printError(java.lang.String command)
|
private static void |
printError(java.lang.String command,
java.lang.Exception e)
|
private static void |
printSeparator()
|
static void |
setVerbose(boolean verboseFlag)
Determines if the Exec class should print which commands are being executed, and print error messages if a problem is found. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static boolean verbose
Constructor Detail |
---|
public Exec()
Method Detail |
---|
public static void setVerbose(boolean verboseFlag)
verboseFlag
- true: print messages.
false: don't.public static boolean getVerbose()
public static boolean exec(java.lang.String command)
command
- The full pathname of the
command to be executed. No shell builtins
(e.g. "cd") or shell meta-chars (e.g. ">")
allowed.
public static boolean execWait(java.lang.String command)
command
- The full pathname of the
command to be executed. No shell builtins
or shell meta-chars allowed.
public static boolean execPrint(java.lang.String command)
command
- The full pathname of the
command to be executed. No shell builtins
or shell meta-chars allowed.
private static boolean exec(java.lang.String command, boolean printResults, boolean wait)
private static void printError(java.lang.String command, java.lang.Exception e)
private static void printError(java.lang.String command)
private static void printSeparator()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |