tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edward Barrow <>
Subject Re: Runtime exec (again)
Date Thu, 02 Dec 2004 09:44:27 GMT
On Thursday 2 December 2004 09:12, 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.
> 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.

This is just an idea, it might be completely wrong, but it could be to do with 
StringTokeniser. Runtime.exec(String) uses StringTokeniser to parse the 
string into tokens, and you might find that it works better if you do it 
yourself and use Runtime.exec(String[])

Edward Barrow
Copyright Consultant (and amateur programmer)
***Important: see for important information 
about the legal status of this email

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message