|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.northwestern.at.utils.ExecUtils
public class ExecUtils
Execute system commands.
Constructor Summary | |
---|---|
protected |
ExecUtils()
Don't allow instantiation, do allow overrides. |
Method Summary | |
---|---|
static java.util.ArrayList |
execAndWait(java.lang.String command,
boolean doWait)
Execute file/command and wait for command to complete. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ExecUtils()
Method Detail |
---|
public static java.util.ArrayList execAndWait(java.lang.String command, boolean doWait)
command
- The command or file name to execute.doWait
- True to wait for the command to return.
Examples:
Windows only directory listing:
ArrayList outputLinesList = execAndWait( "dir" , true );
Directory listing for MacOSX and similar Unixen:
ArrayList outputLinesList = execAndWait( "ls -la" , true );
Open Acrobat file in Acrobat reader, if installed (Windows and MacOSX):
ArrayList outputLinesList = execAndWait( "mydoc.pdf" , false );
Note: On some Unixen and possibly MacOSX, you may need to add a path specifier to get the file "executed." E.g., if the document is in the current directory:
ArrayList outputLinesList = execAndWait( "./mydoc.pdf" , false );
When running a file that causes the associated application to start, and doWait is true, execAndWait may not return until that associated application is closed. You should invoke execAndWait on a separate thread if you want the execute the command and allow your program to continue executing concurrently as well.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |