Session sess = conn.openSession()
sess.execCommand(..)
Thread.currentThread().sleep(5000)
再执行下一个命令
______________________________________________________
楼主是用Runtime实现调用远程命令吗,
试试看用process的waitfor()方法,等待上一个进程执行完了再执行下一个
Process child1 = Runtime.getRuntime().exec(命令1);
child1.waitFor()
.....
....
Process child4 = Runtime.getRuntime().exec(命令4);
child1.waitFor()
public static void main(String[] args){try {
File file = new File("test/pp/tt/asd.txt")
File parent = file.getParentFile()
if(parent!=null&&!parent.exists()){
parent.mkdirs()
}
file.createNewFile()
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace()
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)