Display hardware info using Java

This code example shows how to display some hardware information using the pi4l java library

[codesyntax lang=”java”]

import com.pi4j.system.NetworkInfo;
import com.pi4j.system.SystemInfo;

import java.io.IOException;
import java.text.ParseException;

public class hardwareinfo 
{
    
    public static void main(String[] args) throws InterruptedException, IOException, ParseException 
	{
        


		System.out.println("----------------------------------------------------");
        System.out.println("HARDWARE INFO");
        System.out.println("----------------------------------------------------");
        System.out.println("Serial Number     :  " + SystemInfo.getSerial());
        System.out.println("CPU Revision      :  " + SystemInfo.getCpuRevision());
        System.out.println("CPU Architecture  :  " + SystemInfo.getCpuArchitecture());
        System.out.println("CPU Part          :  " + SystemInfo.getCpuPart());
        System.out.println("CPU Temperature   :  " + SystemInfo.getCpuTemperature());
        System.out.println("CPU Core Voltage  :  " + SystemInfo.getCpuVoltage());
        System.out.println("CPU Model Name    :  " + SystemInfo.getModelName());
        System.out.println("Processor         :  " + SystemInfo.getProcessor());
        System.out.println("Hardware Revision :  " + SystemInfo.getRevision());
        System.out.println("Is Hard Float ABI :  " + SystemInfo.isHardFloatAbi());
        System.out.println("Board Type        :  " + SystemInfo.getBoardType().name());
        
            
        System.out.println();
        System.out.println();
    }
}

[/codesyntax]

 

Build and run and you should see something like the following

hardware info

Related posts

TLV493D magnetic sensor and Raspberry Pi 4 python example

SHT40 Digital Humidity Sensor and Raspberry Pi 4 python example

LTR390 UV Light Sensor a Raspberry Pi 4 in python

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More