You can write a simple code in Java and create a Shut Down timer system for your computer. But before you execute the code, make sure you have already installed JDK on your system.
Open Notepad, type this simple Java code and save the file with the .java extension inside your ideal location. Open the command prompt in Windows or terminal for Mac, set the directory and execute the program. If you forgot how to compile and run a java program, see this guide.
Compiling and running a Java program is the same for all Operating Systems. The only variation comes when you need to set the path for JDK.
You can make the statements comment that you don’t want to execute. For instance, if you only want to shut down your system after a specific period of time, make all the other shut down and restart statements a comment by attaching // as a prefix except r.exec(“shutdown -s -t 10”);