Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

servlet not executing my script ?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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();
}
}
 
What's wrong? Where are you going? Stop! Read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic