手机电池余量 java,用Java获取电池电量
生活随笔
收集整理的這篇文章主要介紹了
手机电池余量 java,用Java获取电池电量
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
I would like to make a java app that shows the current battery level of my mac OS X.
I have read get OS-level system information and was wondering how I could modify this to make it display the current % of battery
Thanks
解決方案
I think you have two options.
One is to use JNI to invoke native code to get the battery level.
The other is to invoke the application pmset using System.exec in java and parse the output. I think the arguments to retrieve the battery level is pmset -g ps but you better check the man page
總結
以上是生活随笔為你收集整理的手机电池余量 java,用Java获取电池电量的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 信息学奥赛一本通 1919:【02NOI
- 下一篇: 找到符合条件的索引_高频面试题:MySQ