Search code examples
javabattery

Java, manage battery on laptop


I would like to manage the battery of my laptop. I want to create a program in java.

I did a lot of research but I do not find it there's a possible way to be able to block the loading of the battery, in java ?

Maybe you could oriented me?

Thank you very much in advance !


Solution

  • I dont't think thats possible using only java, because the information about the battery status is available in the operating system only. I recommend you ready this article:

    https://stackoverflow.com/a/3434962/3234981

    It describes how to manage the access to the battery, using JNA. So if you want to access the battery, this would be the way to go.