try{
String cmdStr="C:\\SSH\\ssh2.exe azik@172.16.20.1 /home/azik/tmp/echo_date.sh";
Process mypro=Runtime.getRuntime().exec(cmdStr);
mypro.waitFor();
Integer errno=mypro.exitValue();
logInfo("The errorlevel is :"+errno);
mypro.destroy();
if (errno != 0) {
logError("Execute Cmd Fail.");
failSession("Catch Exception!");
}
} catch(Exception e) {
logError(e.toString());
failSession("Catch Exception!");
}
【笔记】【Informatica】Java组件调用ssh客户端远程执行linux系统上的shell脚本
原文:http://www.cnblogs.com/AzikPhil/p/Informatica_Java_SSH.html