2

I want to develop a Java application, hoping that the system never goes to hibernate when my application running.

The application will be deployed in Windows.

Is there any way to realize this?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
konjac
  • 757
  • 8
  • 14
  • 1
    Look at this post :http://stackoverflow.com/questions/629240/prevent-windows-from-going-into-sleep-when-my-program-is-running – W A K A L E Y May 31 '13 at 07:11
  • What can java do in this? – commit May 31 '13 at 07:14
  • While not specifically Java related. I do know of a guy who tied a mouse to an oscillating fan to get it to drag the mouse back and forwards. Not exactly high tech, but it works (and it is humorous). – Mr Moose May 31 '13 at 08:07

3 Answers3

1

There is nothing in java for this.

There are windows API to prevent hibernation. See this thread Prevent windows from going into sleep when my program is running?

You could all call them via JNI or JNA

Community
  • 1
  • 1
Jayan
  • 18,003
  • 15
  • 89
  • 143
0

There are two ways to avoid your system going into Hibernate mode when your application is running:

1) I don't know which Windows operating system you are talking about; but we can disable or enable Hibernation at an operating system level. The enabling/disabling method might differ for different Window versions.

2) Another way would be to write a C++ program that uses Win32 API to interact at system level. After writing the code, you can export it as a DLL library and then use it in the Java program. Below link provides a sample code that will help you achieve similar functionality.

http://www.codeguru.com/cpp/w-p/system/messagehandling/article.php/c6907/JavaC-PC-Standby-Detect-and-Prevent.htm

0

I had similar problems when i wanted to connect via RDP to my pc, i left teamviewer on, but my pc went to hibernate/sleep and this is my solution how i keep my pc "active".

Try this, go to Control Panel->Power Options:

This image shows how things look like on Windows 7

and there u can select power plan, click on "Change plan settings" and u will get to this screen:

This image shows how things look like on Windows 7, edit plan settings

Hope that this will help u.

If u need some programmatic solution, try with this link: How do you keep the machine awake?

Community
  • 1
  • 1
anotherUser
  • 551
  • 6
  • 29