|
Applications occasionally need to start other programs. For example, one might want to start a browser. The java.lang.Runtime and java.lang.Process classes are available for executing and communicating with external programs. Here is code to run a MS-DOS batch file that does a directory listing. The program reads the output from this program and prints it out.
Note that this obviously involves the details of the particular host platform and OS. For example, the exec method does not use a shell. If a shell is needed, then it can be run directly. Communication can only be via the standard in, out, and err streams.
|
||||||||||||
|
|||||||||||||