I am working on a "Russian roulette" game in Processing, where one of the buttons shuts down the computer.
Is this possible?
I am working on a "Russian roulette" game in Processing, where one of the buttons shuts down the computer.
Is this possible?
Your question is very broad, but the short answer is yes, this is possible.
However, it's also going to be OS specific: shutting down a Windows computer is different from shutting down a Mac computer, etc.
You can start by googling "java shutdown computer" for a ton of results, but a very basic attempt (taken from this SO question) is something like this:
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("shutdown -s -t 0");
You can use, in Linux:
and in Windows:
Finally put this sentence to terminate the process:
I expect it helps to you!