How to use java to log off windows. It could be using some windows own exe through Runtime(), or and other methods.It would be more efficient if you could provide some good alternative than using external programs like nircmd.exe .
When I use this code,
String shutdownCmd = "rundll32.exe shell32.dll,SHExitWindowsEx 0";
Process child = Runtime.getRuntime().exec(shutdownCmd);
I get
C:\Windows\System32\logoff.exe
logs you off of Windows, so why don't you run that? – Tailband