JAVA 判断进程
public boolean getProcess(String proName) throws Exception {
??? ??? Process p = Runtime.getRuntime().exec("cmd /c tasklist");
??? ??? ByteArrayOutputStream baos = new ByteArrayOutputStream();
??? ??? InputStream os = p.getInputStream();
??? ??? byte b[] = new byte[1024];
??? ??? while (os.read(b) > 0) {
??? ??? ??? baos.write(b);
??? ??? }
??? ??? String s = baos.toString();
??? ??? if (s.indexOf(proName) >= 0) {
??? ??? ??? return true;
??? ??? } else {
??? ??? ??? return false;
??? ??? }
??? }
?
?
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
说明:这个方法是基于命令行的,所有你要保证的是cmd的命令能启用,要不然是不用不来的