I am getting the following message when i try to do this to execute using
JSP.
/command.jsp.java:11: Incompatible type for declaration. Can't convert java.lang.String to java.lang.Process.
Process p="null";
^
1 error
can anyone please tell me why is this happening and how to correct it...
the code for command.jsp is
<%
String compilefile="none";
String runfile="none";
compilefile = request.getParameter("compile");
runfile = request.getParameter("run");
%>
<%!public String command(String compile){
Process p="null";
BufferedReader inStream = null;
Runtime r = Runtime.getRuntime();
// try executing the command
try {
p = r.exec("make");
return("files compiled");
} catch(IOException e) {
System.out.println("Error executing compile");
}
return(" not compiled");
// read results from process standard output
try {
inStream = new BufferedReader(new InputStreamReader(p.getInputStream()));
System.out.println(inStream.readLine());
return("this is it");
} catch(IOException e) {
System.out.println(e);
}
return("this is not it");
}%>
<% if (compilefile!="null" && runfile=="null"){
command(compilefile);
}
if (compilefile=="null" && runfile!="null"){
command(runfile);
}
%>
-kota