Thanks a lot for the replies. They are very helpful. I made some progress.
I found that the external program can be launched within JSP only if it is stateless. If the external program tries to open a window, the process will be hanging on and never get finished. I know, in reality, we won't use servlet to start an external program on server to open a window. But, I guess Tomcat doesn't have this capability, either. Please correct me if I am wrong. Thanks, Jack -----Original Message----- From: Reynir H�bner [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 2:46 PM To: Tomcat Users List Subject: RE: How to execute a command line program in jsp or servlet? try doing : Runtime r = Runtime.getRuntime(); Process p = r.exec(ExecutionParam); //and if you want to wait while the process executes you can use : p.waitFor(); all of this inside a try/catch block should compile and work. hope it helps -reynir > -----Original Message----- > From: Jack Li [mailto:[EMAIL PROTECTED]] > Sent: 10. september 2002 19:50 > To: '[EMAIL PROTECTED]' > Subject: How to execute a command line program in jsp or servlet? > > > Hi, How to execute a command line program in jsp or servlet? > > In a test program, I tried to execute a batch program in a > jsp file and it > didn't work. The batch program test.bat only has on simple line: > > > > dir > lst.txt > > > > In the test.jsp I called the batch program as following: > > > > try{ > > Runtime rt = Runtime.getRuntime(); > > rt.exec("c:\\test.bat"); > > }catch(IOException e){ > > out.println(e.getMessage()); > > } > > > > Any help? > > > > Thanks, > > Jack Li > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
