Re: Batch files from JSP

2006-08-02 Thread Thomas Joseph
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


Re: Batch files from JSP

2006-08-02 Thread Akshay Ahooja

Thanks for that...

I went over that document and a few others on Google...the batch file is
still not working out.

Instead of a batch file if I try and execute a perl script (.PL) located on
the host from a remote computer ...

Process pr= rt.exec(c:\\Program Files\\Apache Software Foundation\\Tomcat
5.5\\webapps\\sheet\\batch\\db.PL);

I get an error=193 error. Based on research, that error means that it cannot
find the program with which to open the file. I have set the environment
variables PATH to the perl bin, as well as added .PL in PATHTEXT.

Any ideas what else I would need?

Thanks,

Akshay

On 8/2/06, Thomas Joseph [EMAIL PROTECTED] wrote:


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




Re: Batch files from JSP

2006-08-02 Thread Bart Busschots
My advice would be to be more specific in the command you shell out with 
and directly call the perl executable.


Something like: Process pr= rt.exec(c:\\Path_to_perl\\perl.exe 
c:\\Program Files\\Apache Software Foundation\\Tomcat

5.5\\webapps\\sheet\\batch\\db.PL);

Bart.

Akshay Ahooja wrote:

Thanks for that...

I went over that document and a few others on Google...the batch file is
still not working out.

Instead of a batch file if I try and execute a perl script (.PL) 
located on

the host from a remote computer ...

Process pr= rt.exec(c:\\Program Files\\Apache Software 
Foundation\\Tomcat

5.5\\webapps\\sheet\\batch\\db.PL);

I get an error=193 error. Based on research, that error means that it 
cannot

find the program with which to open the file. I have set the environment
variables PATH to the perl bin, as well as added .PL in PATHTEXT.

Any ideas what else I would need?

Thanks,

Akshay

On 8/2/06, Thomas Joseph [EMAIL PROTECTED] wrote:


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







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]