Re: RV: Runtime.exec()

2002-10-23 Thread Nigel . Byrnes

If i understand your mail correctly, you are attempting to call/run an
external program. If so, then you need to get a pointer to the JVMs RunTime
environment and execute your command[s] in a new process. Note that you'll
need to setup the environment of the process. On a win32 platform, you'll
be looking to do something like this:

public void foo (String [] myCmds)
{
  try
  {
  // construct the the list of commands to be run based upon
  // - a set of cmds required to setup the environment of the process
  // - the user cmds in myCmds
String [] cmds = runTheseCmds (myCmds); // see javadoc/google for
more info
Runtime r = Runtime.getRuntime ();
Process p = r.exec (cmds);

  // here you can access stdout/stderr if you like


p.waitFor();
p.destroy();
  }
  catch (...)
  {
// see javadoc for the exceptions you need to catch
  }
}

--
Nigel Byrnes
E-Commerce, Direct Line
0845 878 2922


   
 
  Ricardo Arias
 
  RicardoA@gentracTo:   
[EMAIL PROTECTED] 
  .com.gt cc: 
 
   Subject:  RV: Runtime.exec()
 
  22/10/02 17:43   
 
  Please respond to
 
  Tomcat Users
 
  List
 
   
 
   
 






-Mensaje original-
De: Ignacio J. Ortega [mailto:nacho;siapi.es]
Enviado el: Martes, 22 de Octubre de 2002 11:46 a.m.
Para: 'Ricardo Arias'
Asunto: RE: Runtime.exec()


This is a user question please use [EMAIL PROTECTED] to ask
this..

Saludos,
Ignacio J. Ortega
 -Original Message-
 From: Ricardo Arias [mailto:RicardoA;gentrac.com.gt]
 Sent: Tuesday, October 22, 2002 4:43 PM
 To: [EMAIL PROTECTED]
 Subject: Runtime.exec()


 Hi I read an article from the web site
 http://w6.metronet.com/~wjm/tomcat/2000/Oct/msg00082.html but
 in the URL
 where put the aplication.exe, I tried this
 http://localhost:8080/www/page.jsp?command=cmd.exe but have
 this message
 Error: java.io.IOException: CreateProcess: c:\winnt\cmd.exe error=2
 I hope your answer, Thanks a lot
 Ricardo Arias.



--
To unsubscribe, e-mail:   
mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: 
mailto:tomcat-user-help;jakarta.apache.org





Direct Line Group Services Limited, registered in England no.3001989, registered 
office 3 Edridge Road, Croydon, Surrey, CR9 1AG. The following are also members of the 
Direct Line group of companies: Direct Line Insurance plc, a member of the General 
Insurance Standards Council and Direct Line Life Insurance Company Limited and Direct 
Unit Trusts Limited, both regulated by the Financial Services Authority. Loans, 
Mortgages, Credit Cards and Savings provided by Direct Line Financial Services 
Limited, registered in England number 2372702, registered office 3 Edridge Road, 
Croydon, Surrey, CR9 1AG. All are members of the Royal Bank of Scotland Group.



--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




Re: RV: Runtime.exec()

2002-10-23 Thread Jean-Francois Arcand
The error you are seeing is relate to the way you create a process under 
win32. Read to avoid it.

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

-- Jeanfrancois

[EMAIL PROTECTED] wrote:

If i understand your mail correctly, you are attempting to call/run an
external program. If so, then you need to get a pointer to the JVMs RunTime
environment and execute your command[s] in a new process. Note that you'll
need to setup the environment of the process. On a win32 platform, you'll
be looking to do something like this:

public void foo (String [] myCmds)
{
 try
 {
 // construct the the list of commands to be run based upon
 // - a set of cmds required to setup the environment of the process
 // - the user cmds in myCmds
   String [] cmds = runTheseCmds (myCmds); // see javadoc/google for
more info
   Runtime r = Runtime.getRuntime ();
   Process p = r.exec (cmds);

 // here you can access stdout/stderr if you like


   p.waitFor();
   p.destroy();
 }
 catch (...)
 {
   // see javadoc for the exceptions you need to catch
 }
}

--
Nigel Byrnes
E-Commerce, Direct Line
0845 878 2922


   
 Ricardo Arias 
 RicardoA@gentracTo:   [EMAIL PROTECTED] 
 .com.gt cc:  
  Subject:  RV: Runtime.exec() 
 22/10/02 17:43
 Please respond to 
 Tomcat Users 
 List 
   
   






-Mensaje original-
De: Ignacio J. Ortega [mailto:nacho;siapi.es]
Enviado el: Martes, 22 de Octubre de 2002 11:46 a.m.
Para: 'Ricardo Arias'
Asunto: RE: Runtime.exec()


This is a user question please use [EMAIL PROTECTED] to ask
this..

Saludos,
Ignacio J. Ortega
 

-Original Message-
From: Ricardo Arias [mailto:RicardoA;gentrac.com.gt]
Sent: Tuesday, October 22, 2002 4:43 PM
To: [EMAIL PROTECTED]
Subject: Runtime.exec()


Hi I read an article from the web site
http://w6.metronet.com/~wjm/tomcat/2000/Oct/msg00082.html but
in the URL
where put the aplication.exe, I tried this
http://localhost:8080/www/page.jsp?command=cmd.exe but have
this message
Error: java.io.IOException: CreateProcess: c:\winnt\cmd.exe error=2
I hope your answer, Thanks a lot
Ricardo Arias.


   


--
To unsubscribe, e-mail:   
mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: 
mailto:tomcat-user-help;jakarta.apache.org





Direct Line Group Services Limited, registered in England no.3001989, registered office 3 Edridge Road, Croydon, Surrey, CR9 1AG. The following are also members of the Direct Line group of companies: Direct Line Insurance plc, a member of the General Insurance Standards Council and Direct Line Life Insurance Company Limited and Direct Unit Trusts Limited, both regulated by the Financial Services Authority. Loans, Mortgages, Credit Cards and Savings provided by Direct Line Financial Services Limited, registered in England number 2372702, registered office 3 Edridge Road, Croydon, Surrey, CR9 1AG. All are members of the Royal Bank of Scotland Group.



--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org


 



RV: Runtime.exec()

2002-10-22 Thread Ricardo Arias


-Mensaje original-
De: Ignacio J. Ortega [mailto:nacho;siapi.es]
Enviado el: Martes, 22 de Octubre de 2002 11:46 a.m.
Para: 'Ricardo Arias'
Asunto: RE: Runtime.exec()


This is a user question please use [EMAIL PROTECTED] to ask
this..

Saludos, 
Ignacio J. Ortega 
 -Original Message-
 From: Ricardo Arias [mailto:RicardoA;gentrac.com.gt]
 Sent: Tuesday, October 22, 2002 4:43 PM
 To: [EMAIL PROTECTED]
 Subject: Runtime.exec()
 
 
 Hi I read an article from the web site
 http://w6.metronet.com/~wjm/tomcat/2000/Oct/msg00082.html but 
 in the URL
 where put the aplication.exe, I tried this
 http://localhost:8080/www/page.jsp?command=cmd.exe but have 
 this message
 Error: java.io.IOException: CreateProcess: c:\winnt\cmd.exe error=2 
 I hope your answer, Thanks a lot
 Ricardo Arias.
 
 

--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org