hi
Iam facing a problem on executing a linux shell script from
JSP using
Tomcat server.Iam successfully able to execute to script using the following
java code
import java.io.*;
class shExecute{
public static void main(
String args[]){
Runtime r=Runtime.getRuntime();
Process p =null;
String cmd="/home/shdir/runmms.sh";
try{
p=r.exec(cmd);
InputStreamReader isr=new Input StreamReader(p.getInputStream());
String line=null;
while((line=br.readLine())!=null){
System.out.println(line);
}
p.waitFor();
}
catch(Exception e){System.out.println(e);}
System.out.println(p.exitValue());
}
}
If i try to run the same script using the following jsp code iam not able to run the script.The following is the JSP code
<%@page import="java.io.*"%>
<%
Runtime r=Runtime.getRuntime();
Process p=null;
String s=null;
String cmd="/home/shdir/runmms.sh";
try{
p=r.exec(cmd);
InputStreamReader isr=new InputStreamReader(p.getInputStream());
BufferedReader br=new BufferedReader(isr);
String line=null;
while((line = br.readLine()) != null){
System.out.println(line);
}
p.waitFor();
}
catchException e){
out.println(e);
}
System.out.println(p.exitValue());
%>
can anybody give me the solution why the same java code is not working using JSP.Can there be any problem with Tomact?
Thanks to all in advance
[ October 29, 2002: Message edited by: Srinivas Saranu ]