日期:2014-05-20  浏览次数:20726 次

linux下java调用sh的问题
public class STMonitor {

public static void main(String[] args) {
Runtime rt = Runtime.getRuntime();

String cmds="sh ststickst.sh";

try {
Process process = rt.exec(cmds);
System.out.println(cmds);
}
catch (IOException ex2) {
System.out.println("执行错误");
}
 
}
}
在linux下执行程序,问什么调用 ststickst.sh 不成功?很困惑,不知道这段代码的问题出在哪里了,请高人指点.
注:jdk是1.3的.

------解决方案--------------------
确认一下ststickst.sh的路径是否正确
------解决方案--------------------
rt.exec(cmds); ???