tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Layman <randy.lay...@aswethink.com>
Subject RE: How can I run Batch file from servlet ??
Date Mon, 16 Apr 2001 15:20:30 GMT

	When you create a process like this, its up to you to read and write
to the process.  This means that any output from your batch file will be
lost unless you deal with is (Process has methods to get the input and
output streams for standard in/out/error).

	I would suggest you try running your batch file from the tomcat's
home directory.  The problem is usually one of two things.  Either you have
relative paths which aren't valid in the current context or you are
expecting environment variables that aren't valid.  (Or possibly its
actually working but you aren't catching the batch file's input to know
that).

	Randy


> -----Original Message-----
> From: Sunil Chandurkar [mailto:sunil@nagpurcity.net]
> Sent: Monday, April 16, 2001 11:47 AM
> To: tomcat-user@jakarta.apache.org
> Subject: How can I run Batch file from servlet ??
> 
> 
> Hello All !! 
> 
> I am in big trouble, i want to call batch file on the server 
> from the servlet. I have tried the following option but they 
> didn't work.. please let me know if is there any way to do it... 
> 
> Process p = Runtime.getRuntime().exec 
> ("cmd D:\\myFolder\\myBatchFile.bat"); 
> p.waitFor(); 
> 
> also i have tried without cmd option: 
> Process p = Runtime.getRuntime().exec 
> ("D:\\myFolder\\myBatchFile.bat"); 
> p.waitFor(); 
> 
> Its not throwing an exception and not even giving me any output.. 
> 
> Thanx in Advance...
> 
> /sunil 
> 
> 
> 
> _____________________________________________________________
> Get LifeTime Free email Visit  ---> http://www.nagpurcity.net
> 

Mime
View raw message