File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes servlet not executing my  script ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Reply locked New topic
Author

servlet not executing my script ?

raghutv raghu
Greenhorn

Joined: Jun 23, 2003
Posts: 2
i am trying to run my script named "run2" with some parameters. Using the following code. Please check the path that i am executing is there any error in it............
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class execu extends HttpServlet {
public void init(ServletConfig config)throws ServletException {
super.init(config);
}
public void service(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><body>");

try
{
String [] path ={"/bin/sh/","//home//raghu//temp//run2","1","1","8","p"};
};
Runtime runtime=Runtime.getRuntime();
Process proc=runtime.exec(path);
proc.waitFor();
}
catch (Exception e)
{
out.println(e);
}
out.println("done");
out.println("</body></html>");
out.close();
}
}
 
 
subject: servlet not executing my script ?
 
Threads others viewed
How to call a Perl program in Servlet?
servlet not executing my script ?
error in connectivity with database
servlet not found
error in connectivity with database
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture