开发者

Java battery meter for Windows

I want to make a battery meter for my computers, which all work on diffe开发者_如何学运维rent OSs. I figured the best way would be in Java. Is there any way to do this WITHOUT external libraries? All it needs to do is show the battery level in a java.swing.JProgressBar.


No, there is no way to do this just using the standard JDK. It is up to the OS to expose details about the current power/battery state, and there is no built-in way to access this information in Java. To do what you want will require at least some external libraries, and almost certainly JNI as well.


Even within the OS, the battery level is a very low-level measurement that is really carried out by the hardware.

At the very least, you would have to use external libraries to do it, but even if you do, there's a good chance that you still wouldn't have a cross-platform solution due to the very different ways batteries are handled by both OS and hardware.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜