kv1402
Posts: 2
Joined: Sun Oct 04, 2015 8:29 am

Application for getting status

Sun Oct 04, 2015 8:34 am

Hi, I was how to make a java program that can get status information about the temperature, CPU info etc. from raspberry pi?

I dont know where to start. :?

User avatar
savageautomate
Posts: 225
Joined: Thu Aug 16, 2012 3:20 pm
Location: USA
Contact: Website

Re: Application for getting status

Mon Oct 05, 2015 11:00 am

If you want to use a library, then a lot of system information is already aggregated for you and accessible via simple Java interfaces using the Pi4J library. Here is the system information example:
http://pi4j.com/example/system-info.html

This example is included in Pi4J if you install it on your Raspberry Pi. It will be in the directory:

Code: Select all

cd /opt/pi4j/examples
You can use the Pi4J shell script to compile it and run it.
Compile:

Code: Select all

pi4j --compile SystemInfoExample.java
Run:

Code: Select all

pi4j SystemInfoExample
If you want the code or to know where Pi4J sources this information you can review the classes listed here:
https://github.com/Pi4J/pi4j/tree/devel ... i4j/system

Good Luck!
Robert
Robert Savage | Follow me @savageautomate
http://www.pi4j.com | http://www.pislices.com
http://www.savagehomeautomation.com

kv1402
Posts: 2
Joined: Sun Oct 04, 2015 8:29 am

Re: Application for getting status

Tue Oct 06, 2015 10:22 pm

savageautomate wrote:If you want to use a library, then a lot of system information is already aggregated for you and accessible via simple Java interfaces using the Pi4J library. Here is the system information example:
http://pi4j.com/example/system-info.html

This example is included in Pi4J if you install it on your Raspberry Pi. It will be in the directory:

Code: Select all

cd /opt/pi4j/examples
You can use the Pi4J shell script to compile it and run it.
Compile:

Code: Select all

pi4j --compile SystemInfoExample.java
Run:

Code: Select all

pi4j SystemInfoExample
If you want the code or to know where Pi4J sources this information you can review the classes listed here:
https://github.com/Pi4J/pi4j/tree/devel ... i4j/system

Good Luck!
Robert

Thank you Robert, I will try this. :D

Return to “Java”