Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 79596 invoked from network); 2 Dec 2004 09:22:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Dec 2004 09:22:14 -0000 Received: (qmail 27802 invoked by uid 500); 2 Dec 2004 09:21:17 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 27786 invoked by uid 500); 2 Dec 2004 09:21:16 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 27762 invoked by uid 99); 2 Dec 2004 09:21:16 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from alpha.eurodyn.com (HELO alpha.eurodyn.com) (62.192.67.250) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 02 Dec 2004 01:21:14 -0800 Received: from parnitha.eurodyn.com (parnitha.eurodyn.com [10.251.0.3]) by alpha.eurodyn.com (8.12.9/8.12.9) with ESMTP id iB29L8CO006919 for ; Thu, 2 Dec 2004 11:21:08 +0200 (EET) Received: by parnitha.eurodyn.com with ESMTP id LAA09753; Thu, 2 Dec 2004 11:21:08 +0200 (EET) Received: from [10.254.255.180] (account keshav.shetty [10.254.255.180] verified) by eurodyn.com (CommuniGate Pro SMTP 4.0.5) with ESMTP id 1920091 for user@struts.apache.org; Thu, 02 Dec 2004 11:21:06 +0200 Message-ID: <41AEDE5E.2090307@eurodyn.com> Date: Thu, 02 Dec 2004 11:20:30 +0200 From: Keshav Shetty User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Struts Users Mailing List Subject: Re: OT: Runtime exec (again) References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N May be cmd.exe is not available within the path when executing from tomcat. Try to add full path and try. Alternatively find out what is the message returned when cmd.exe is executed within the tomcat(Not the return code). You can display this message using following code. exitValue = proc.waitFor(); BufferedInputStream is = new BufferedInputStream(proc.getInputStream()); java.lang.System.out.println("Printing output rom the consle"); while (is.available() > 0) { java.lang.System.out.print((char)is.read()); } Thanks & regards Keshav K Shetty andy wix wrote: > Hi, > > Still can't get this to work. > > There must be some reason why this won't run under Tomcat but does > work stand-alone. I have also tried the Tomcat list to no avail. > > To recap, I am trying to execute the following code on an Xp box with > Tomcat 5.0.27: > > Process proc = runtime.exec("cmd.exe /C shutdown -r -f -m \\myPC -t 50"); > int exitVal = proc.waitFor(); > > When this runs the proc exits with a value of 0 but nothing happens > (no re-boot) and no exceptions are thrown. > > I have tried running the code from a batch file and without the > cmd.exe /C bit. > > I have tried running Tomcat from the command line (not as service). > > I have tried allowing all permissions in the catalina.policy file: > grant codeBase "file:${catalina.home}/webapps/ROOT/WEB-INF/classes/-" { > permission java.security.AllPermission "*"; > }; > > I CAN successfully set the the system time and date using the same > approach > though. > > I have absolutely no idea on this now. > > Thanks, > Andy > > _________________________________________________________________ > It's fast, it's easy and it's free. Get MSN Messenger today! > http://www.msn.co.uk/messenger > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > For additional commands, e-mail: user-help@struts.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org