Do this (-l
for logoff here, -r
for restart, etc.):
String shutdownCmd = "shutdown -l";
Process child = Runtime.getRuntime().exec(shutdownCmd);
or (0
for logoff here):
String shutdownCmd = "rundll32.exe shell32.dll,SHExitWindowsEx 0";
Process child = Runtime.getRuntime().exec(shutdownCmd);