import java.io.*;
import java.net.*;
import java.util.*;
public class runshell {
public static void main(String a[]) throws Exception {
List cmds = new ArrayList();
cmds.add("sh");
cmds.add("-c");
cmds.add("ps -ef | grep -v grep");
ProcessBuilder pb =new ProcessBuilder(cmds);
Process pl = pb.start();
String line = "";
BufferedReader p_in = new BufferedReader(new InputStreamReader(pl.getInputStream()));
while ((line = p_in.readLine()) != null) {
System.out.println(line);
}
p_in.close();
}
}
閱讀全文...