May be you can google "Java runtime exec"

I found this one good. - 
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html 

Hope this can help

Thanks and Regards,
Thomas Joseph 

Kott Software Pvt. Ltd. | Vallamattom Estate | M.G.Road | Cochin-682015 | India 
www.kottsoftware.com 
--------------------------------------------------------------------------------
This email (including any attachments) is subject to copyright, the information 
in it is confidential, and it is legally privileged. Use of this email or of 
any information in it other than by the addressee is unauthorized and unlawful. 
If you are not the intended recipient of the mail, kindly intimate the author 
of the mail and delete the same. 
--------------------------------------------------------------------------------

  ----- Original Message ----- 
  From: Akshay Ahooja 
  To: Struts Users Mailing List 
  Sent: Tuesday, August 01, 2006 11:35 PM
  Subject: Batch files from JSP


  Hi,

  This is not entirely a struts question, but how would I execute a batch from
  on the server from a jsp?

  If the .bat is in the same file as the jsp calling it.


  I tried

      Runtime rt = Runtime.getRuntime();

      Process pr= rt.exec("db.bat");

  But it gives errors.

  java.io.IOException: CreateProcess: db.bat error=2
  java.lang.ProcessImpl.create(Native Method)
  java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
  java.lang.ProcessImpl.start(ProcessImpl.java:30)
  java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
  java.lang.Runtime.exec(Runtime.java:591)
  java.lang.Runtime.exec(Runtime.java:429)
  java.lang.Runtime.exec(Runtime.java:326)
  org.apache.jsp.batch_jsp._jspService(batch_jsp.java:59)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


  Any help would be great,

  Thanks,

  Akshay

Reply via email to