日期:2014-05-20 浏览次数:20910 次
int c;
String cmd = "....";
Process child = Runtime.getRuntime().exec(cmd);
// 获得运行的输出
InputStream child_in = child.getInputStream();
String strReturn = "";
while ((c = child_in.read()) != -1) {
strReturn += (char) c;
}
child_in.close(); //得到运行的返回结果
------解决方案--------------------
你要用waitFor等待你的vb脚本执行结束以后再谈出窗口
for example
Process p = Runtime.getRuntime().exec("vb脚本");
p.waitFor();
JOptionPane.showMessageDialog(null, "finish");
------解决方案--------------------
你不光拿inputstream, errorStream也要拿哦, 不然你程序有死锁情况的