How do you keep the machine awake?

Question :

How do you keep the machine awake?,

Answer :

I have a piece of server-ish software written in Java to run on Windows and OS X. (It is not running on a server, but just a normal user’s PC – something like a torrent client.) I would like the software to signal to the OS to keep the machine awake (prevent it from going into sleep mode) while it is active.

Of course I don’t expect there to be a cross platform solution, but I would love to have some very minimal C programs/scripts that my app can spawn to inform the OS to stay awake.

Read More  api documentation and “value limits”: do they match?

Any ideas?

,

I use this code to keep my workstation from locking. It’s currently only set to move the mouse once every minute, you could easily adjust it though.

It’s a hack, not an elegant solution.

import java.awt.*;  import java.util.*;  public class Hal{        public static void main(String[] args) throws Exception{          Robot hal = new Robot();          Random random = new Random();          while(true){              hal.delay(1000 * 60);              int x = random.nextInt() % 640;              int y = random.nextInt() % 480;              hal.mouseMove(x,y);          }      }  }  

That’s the answer How do you keep the machine awake?, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Read More  In what order are ON DELETE CASCADE constraints processed?

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you