Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 52780 invoked from network); 10 Sep 2002 19:55:44 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 10 Sep 2002 19:55:44 -0000 Received: (qmail 10591 invoked by uid 97); 10 Sep 2002 19:56:01 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 10544 invoked by uid 97); 10 Sep 2002 19:56:00 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 10529 invoked by uid 98); 10 Sep 2002 19:56:00 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) content-class: urn:content-classes:message Subject: RE: How to execute a command line program in jsp or servlet? MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Tue, 10 Sep 2002 19:46:11 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 Message-ID: <88500E0F870AA542B6340D8BC05A9E1B0F543F@rup.hugsmidjan.is> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: How to execute a command line program in jsp or servlet? Thread-Index: AcJZAjMy/Bnw1rQWTBi0faTU/mJVGwAAXinw From: =?iso-8859-1?Q?Reynir_H=FCbner?= To: "Tomcat Users List" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N try doing :=20 Runtime r =3D Runtime.getRuntime(); Process p =3D r.exec(ExecutionParam); //and if you want to wait while the process executes you can use :=20 =20 p.waitFor(); all of this inside a try/catch block should compile and work. =20 hope it helps -reynir > -----Original Message----- > From: Jack Li [mailto:JLi@MurraysDiscount.com] > Sent: 10. september 2002 19:50 > To: 'tomcat-user@jakarta.apache.org' > Subject: How to execute a command line program in jsp or servlet?=20 >=20 >=20 > Hi, How to execute a command line program in jsp or servlet?=20 >=20 > In a test program, I tried to execute a batch program in a=20 > jsp file and it > didn't work. The batch program test.bat only has on simple line: >=20 > =20 >=20 > dir > lst.txt >=20 > =20 >=20 > In the test.jsp I called the batch program as following: >=20 > =20 >=20 > try{ >=20 > Runtime rt =3D Runtime.getRuntime(); >=20 > rt.exec("c:\\test.bat"); >=20 > }catch(IOException e){ >=20 > out.println(e.getMessage()); >=20 > } >=20 > =20 >=20 > Any help? >=20 > =20 >=20 > Thanks, >=20 > Jack Li >=20 > =20 >=20 >=20 -- To unsubscribe, e-mail: For additional commands, e-mail: