tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Francois Arcand <jeanfrancois.arc...@sun.com>
Subject Re: How to execute a command line program in jsp or servlet?
Date Tue, 10 Sep 2002 19:54:17 GMT
See  http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html.

In brief, you cannot execute a batch file this way. The article contains 
examples and will solve your problem.

-- Jeanfrancois

Jack Li wrote:

>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:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message