Redian新闻
>
question about using Runtime.getRuntime.exec() in Tomcat
avatar
question about using Runtime.getRuntime.exec() in Tomcat# Java - 爪哇娇娃
b*l
1
Now I am trying to launch an external application in my web application, and
killing it by PID after a while. But when I execute Runtime.getRuntime.exec
() in my JSP page or Servlet, Tomcat is stuck in that page and do not
display anything. It seems that it will run forever. Is there any solution
to solve this problem?
BTW, I do not use System.exit() in my program. It may cause Security Manager
problem.
Thanks!
avatar
a*i
2
does your external app deal with any standard input/output/error? if so, you
need to empty them, check this out http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=1

and
exec
Manager

【在 b**l 的大作中提到】
: Now I am trying to launch an external application in my web application, and
: killing it by PID after a while. But when I execute Runtime.getRuntime.exec
: () in my JSP page or Servlet, Tomcat is stuck in that page and do not
: display anything. It seems that it will run forever. Is there any solution
: to solve this problem?
: BTW, I do not use System.exit() in my program. It may cause Security Manager
: problem.
: Thanks!

avatar
b*l
3
已经解决了,问题就在于读了p.getInputStream(),不读这个,程序就不会停

the
avatar
b*l
4
我试了读errorStream,但是还是会让程序停止,不知道这种问题有什么解决办法?
既能得到信息,有不会停住程序。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。