以下代码在windows2000上可以运新哦。
SayHi.exe为任意的一个执行程序。
public static void main(String args[]) {
String s = null;
// system command to run
String cmd = "cmd /c c:/SayHi.exe";
// set the working directory for the OS command processor
File workDir = new File("c://");
try {
Process p = Runtime.getRuntime().exec(cmd, null, workDir);
int i = p.waitFor();