struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Barrows" <>
Subject RE: Runtime exec (again)
Date Thu, 02 Dec 2004 16:16:21 GMT
If you can get one command to run, and not the other... problem must be with the way the shutdown
is being handled.  I don't do windows, however it may be possible (easy to do under Unix,
but with Windows sorry execuse for a shell scripting language I dunno) to find out what user
the batch command is being run as, and see what king of permissions it has.

Either way it has to do with the shutdown command and the way it's being run and not the execution
of the Java code.

> -----Original Message-----
> From: andy wix []
> Sent: Thursday, December 02, 2004 2:11 AM
> To:
> Subject: OT: Runtime exec (again)
> 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 

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 "*";

I CAN successfully set the the system time and date using the same approach

I have absolutely no idea on this now.


It's fast, it's easy and it's free. Get MSN Messenger today!

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

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

View raw message