//p.exitValue() 是它的结束符,p.waitFor()用来等待程序结束。import java.lang.*;
import java.io.*;
public class testmyprogram
{
public static void main(String args[])
{
Process p = null;
try{
p =Runtime.getRuntime().exec("notepad.exe");
//p.waitFor();
System.out.println(p.exitValue());
}
catch(Exception e){
System.err.println( "Program has not exited.");
try{
p.waitFor();
}catch(InterruptedException ee){
}
System.err.println( "Program has exited.");
}
//return;
}
}
import java.io.*;
public class testmyprogram
{
public static void main(String args[])
{
Process p = null;
try{
p =Runtime.getRuntime().exec("notepad.exe");
//p.waitFor();
System.out.println(p.exitValue());
}
catch(Exception e){
System.err.println( "Program has not exited.");
try{
p.waitFor();
}catch(InterruptedException ee){
}
System.err.println( "Program has exited.");
}
//return;
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货