java web中调用shell问题
环境ubuntu11.04 jdk1.6 eclipse juno tomcat 6.0.35一个简单的web程序,点击一个button,执行一个shell(比如打印一个helloworld),用的是Process process = Runtime.getRuntime().exec(shellstring)方法,问题是如果我的helloworld.sh放在webcontent下面启动webservice是可以执行的,但是如果写成这个样子exec("sh /home/jasonhuo/monitor/rhapcom/helloworld.sh"),部属到远程服务器上,执行服务器上的helloworld.sh,操作系统就换回126错误代码,helloworld.sh已经有可执行权限(chmod a+x helloworld.sh),请问是什么原因? 好像是java无法找到sh。我忘记了在哪里看到过一篇文章。说明了这个问题。
页:
[1]