Runtime.getRuntime().exec()执行linuxshell脚本

Linux下:

String[] command = { "/bin/sh", "-c", cmmd };

Process ps = Runtime.getRuntime().exec(command);

Windows下:

String[] command = { "cmd.exe", "/c", cmmd };

Process ps = Runtime.getRuntime().exec(command);

原文链接:https://www.xuebuyuan.com/1290921.html

你可能感兴趣的:(Runtime.getRuntime().exec()执行linuxshell脚本)