How to restart windows(all flavours) from java?

Hi can anybody help me how to restart windows(all flavors) from a java program.

Is it possible using Runtime.exec(). If so, what is the process name I have to pass? . My requirement is to popup a wraning message saying "Restart Windows Now? " with "Yes" or "No" buttons. On selecting "Yes" the it should restart windows

regards

Swamy S

[389 byte] By [Sirigineedia] at [2007-10-1 15:32:01]
# 1
You can write a Windows DLL and use JNI to reboot the system. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/how_to_shut_down_the_system.asp- Saish
Saisha at 2007-7-10 19:48:04 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...
# 2

Hi!! i think u can do it without the need for using JNI. The code below works fine on win xp and above. There may be similar commands for win 98 & ME. Try googling for restarting command on win 98.

Use JOptionPane class to display the msg box u asked.

Process p=Runtime.getRuntime().exec("shutdown /s /t 00");

Use the "shutdown /r" for restarting.

Aswina at 2007-7-10 19:48:04 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...