• Runtime.getRuntime最简单的命令执行。
    1. import java.io.IOException;
    2. public class Run001 {
    3. public static void main(String[] argv) throws IOException {
    4. Runtime run = Runtime.getRuntime();
    5. Process p = run.exec("calc");// 启动另一个进程来执行命令
    6. }
    7. }