That sounds like the PATH environment variable isn't set (as in it
can't find osql).

> -----Original Message-----
> From: Sunil Chandurkar [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 16, 2001 12:08 PM
> To: [EMAIL PROTECTED]
> Subject: RE: How can I run Batch file from servlet ??
> 
> 
> Randy.... 
> Actually this batch file contains sql command..
> like
> osql -U sa -P -i D:\Myfolder\CreateDatabase.sql
> 
> i have tried this time.. with "/c start" option
> Process p = Runtime.getRuntime().exec 
>  ("cmd /c start D:\\myFolder\\myBatchFile.bat"); 
>  p.waitFor(); 
> and this time its able to fire the batch file
> but that batch file itself giving error that "The name 
> specified is not recognized as an internal or external command"
> 
> The good thing is this option of running batch file is 
> working with standalone java application but not with servlet..
> 
> /sunil
> --- Randy Layman <[EMAIL PROTECTED]>
> > wrote:
> >
> >     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:[EMAIL PROTECTED]]
> >> Sent: Monday, April 16, 2001 11:47 AM
> >> To: [EMAIL PROTECTED]
> >> 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
> >>
> 
> _____________________________________________________________
> Get LifeTime Free email Visit  ---> http://www.nagpurcity.net
> 

Reply via email to