tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sunil Chandurkar <su...@nagpurcity.net>
Subject RE: Randy - RE: How can I run Batch file from servlet ??
Date Mon, 16 Apr 2001 17:02:38 GMT

Thanx..

its working very finely

/sunil
--- Randy Layman <randy.layman@aswethink.com>
> wrote:
>
>	Try replacing the relative osql with the fully-qualified path name
>(i.e. "C:\Program Files\Oracle Apps\bin\osql.exe").
>
>	I have several servlets that utilize external processes (and several
>other applications).  I've found that you can never count on environment
>variables to be correctly set, even when you use cmd.
>
>	Randy
>
>> -----Original Message-----
>> From: Sunil Chandurkar [mailto:sunil@nagpurcity.net]
>> Sent: Monday, April 16, 2001 12:44 PM
>> To: tomcat-user@jakarta.apache.org
>> Subject: Randy - RE: How can I run Batch file from servlet ??
>> 
>> 
>> 
>> I have set that path variable already.. still its not working 
>> did u find anyother solution....
>> 
>> thanx.. for responding lot...
>> 
>> /sunil
>> --- Randy Layman <randy.layman@aswethink.com>
>> > wrote:
>> >
>> >	That sounds like the PATH environment variable isn't 
>> set (as in it
>> >can't find osql).
>> >
>> >> -----Original Message-----
>> >> From: Sunil Chandurkar [mailto:sunil@nagpurcity.net]
>> >> Sent: Monday, April 16, 2001 12:08 PM
>> >> To: tomcat-user@jakarta.apache.org
>> >> 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 <randy.layman@aswethink.com>
>> >> > 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: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
>> >> >>
>> >> 
>> >> _____________________________________________________________
>> >> Get LifeTime Free email Visit  ---> http://www.nagpurcity.net
>> >>
>> 
>> _____________________________________________________________
>> Get LifeTime Free email Visit  ---> http://www.nagpurcity.net
>>

_____________________________________________________________
Get LifeTime Free email Visit  ---> http://www.nagpurcity.net

Mime
View raw message