There is no “platform independent” way of reading battery levels; Such hardware information is extremely OS specific. The only way to have a "platform-independent" Java interface is to write a JNI wrapper for each target platform.
(Actually, on Linux this is pretty simple: all this information is displayed as text files under /proc/acpi/battery , so you don’t need any JNI. I don’t think OS X has the same friendly presentation, and I "Of course, Windows doesn't.)
source share