请问:
用Process p = Runtime.getRuntime().exec("*.exe");
这种方法开启的进程,如何让Java程序知道这个进程是否还存在?
感谢!!!=)
用Process p = Runtime.getRuntime().exec("*.exe");
这种方法开启的进程,如何让Java程序知道这个进程是否还存在?
感谢!!!=)
解决方案 »
- 对象引用有关的
- 怎样用java编写一个冒泡程序(字符串)
- 这个界面怎么做哦?
- eclipse中如何将断点设在LinkedList的addBefore方法的某句话上
- 小菜鸟要送分了
- 大家来帮忙,关于equals的问题
- 麻烦帮忙,关于thinking in java 4th source code
- JTextField[] txtfldName=new JTextField[100]初始化时占内存么!??
- 如何在客户端编程以实现在远程机器(如服务器)上创建目录的功能???
- 谁为我解惑??!!!关于数据库连接池........................
- 在用sleep()方法时出现的一个不我不解的问题
- 有关上传文件的问题(java.lang.IllegalArgumentException)
抛异常说明进程尚未终止
定时扫描进程 new Thread(){
public void run(){
while(true){
System.out.println(1);
try{
Process p = Runtime.getRuntime().exec("cmd /c tasklist");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream os = p.getInputStream();
byte b[] = new byte[256];
while(os.read(b)>0)
baos.write(b);
String s = baos.toString();
//System.out.println(s);
if(s.indexOf("SQLyog.exe")>=0)
System.out.println("yes");
else
System.out.println("no");
Thread.sleep(1000);
}catch(InterruptedException ie){
}catch(java.io.IOException ioe){
}
}
}
}.start();
进程名可以相同,PID唯一
并且,Runtime.getRuntime().exec("*.exe");你如何能准确的知道进程名呢??!
JDK 5.0里的bin\jps,再反编译一下看看:)
用什么工具反编译啊
怎么然Java执行这个“ tasklist ¦find "cmd.exe " ”???
以前没见过这个东西。
怎么然Java执行这个“ tasklist ¦find "cmd.exe " ”???
以前没见过这个东西。
DJ Java Decompiler可以反编译
什么意思,不明白啊!
Runtime.getRuntime().exec("tasklist |find "cmd.exe");