You'll need to use the Mac OS X APIs:
You can get information about power
sources and UPS (uninterruptible power
supply) devices using the I/O Kit’s
power-source API located in
/System/Library/Frameworks/IOKit.framework/Headers/ps.
The header files in this folder,
IOPowerSources.h and IOPSKeys.h,
contain methods and keys to extract
information about both external and
internal power sources. For example,
an application can get a list of
attached power sources, request
notifications for changes in its power
sources, and determine how much power
is left in a battery.
[edit]
You will need to use JNI to access the IOKit framework.