Hi,
I've a class as under , which is getting run from a JSP. The JSP is providing the Batch File to Run :
==========================================================
==========================================================
and this is the windows batch file :
==========================================================
==========================================================
This works fine, if I run this batch file by itself from the DOS Prompt, however , hangs if I am calling it from a JSP. This was working fine without the ftp command in the batch file from the jsp ( the dir by itself was working ok )
Any help would be appreciated.
Thanks.
I've a class as under , which is getting run from a JSP. The JSP is providing the Batch File to Run :
==========================================================
Code:
public int runbat(String batchfilename) throws Exception{
Runtime rt = Runtime.getRuntime();
String cmd="E:\\myweb\\" + batchfilename;
Process proc = rt.exec(cmd);
InputStream stdin = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(stdin);
BufferedReader br = new BufferedReader(isr);
String line = null;
System.out.println("<OUTPUT>");
while ( (line = br.readLine()) != null)
System.out.println(line);
System.out.println("</OUTPUT>");
int exitVal = proc.waitFor();
System.out.println("Process exitValue: " + exitVal);
return(exitVal);
}
and this is the windows batch file :
==========================================================
Code:
SET @LOGFILE="E:\myweb\SIMPLE.BAT.LOG"
ECHO. >>%@LOGFILE%
dir >>%@LOGFILE%
ECHO Commencing FTP... >>%@LOGFILE%
C:\WINNT\SYSTEM32\FTP.EXE -s:ftp_xyz.scr xyz.com >>%@LOGFILE%
ECHO .................................................>>% @LOGFILE%
This works fine, if I run this batch file by itself from the DOS Prompt, however , hangs if I am calling it from a JSP. This was working fine without the ftp command in the batch file from the jsp ( the dir by itself was working ok )
Any help would be appreciated.
Thanks.