IT-Academy

Vypnutie za minutu

Mar 11th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. int minutes = 1; //Integer.valueOf(args[0]);
  2.         Timer timer = new Timer();
  3.         timer.schedule(new TimerTask() {
  4.          
  5.             @Override
  6.             public void run() {
  7.                 ProcessBuilder processBuilder = new ProcessBuilder("shutdown",
  8.                         "/s");
  9.                 try {
  10.                     processBuilder.start();
  11.                 } catch (IOException e) {
  12.                     throw new RuntimeException(e);
  13.                 }
  14.             }
  15.         }, minutes * 60 * 1000);
Advertisement
Add Comment
Please, Sign In to add comment