Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: get system info

  1. #1

    Default get system info

    hi
    how i can get my system info in java se
    like
    cpu=Intel(R) Core(TM) i7-4702MQ CPU @ 2.20GHz
    ram=Bank label: BANK 0, Capacity: 4 GiB, Clock speed: 1.6 GHz, Manufacturer: Samsung, Memory type: DDR3
    HDD=WDC WD20SPZX-22UA7T0  
    HDD Size=1863.01 GB
    graphic = Intel(R) HD Graphics 4600 
    Graphic = 1GB
    motherboard Brand = asus
    motherboad model = PRIME B460M-A
    monitor = Samsung
    Pinter = hp laserjet 4500
    scanner = hp 220
    os install time = 12:45 19/12/2021

    How to get information similar to the above without using the Windows command line i need use Java libraries
    i can't find some code for HDD and graphic and motherboard and monitor and other connected device like scanner




    --- Update ---

    for cpu i use this code and oshi library

    SystemInfo systemInfo = new SystemInfo();
            HardwareAbstractionLayer hardware = systemInfo.getHardware();
            CentralProcessor processor = hardware.getProcessor();
            CentralProcessor.ProcessorIdentifier processorIdentifier = processor.getProcessorIdentifier();
            txtcpu1.setText(processorIdentifier.getName());
     
            System.out.println("Processor Vendor: " + processorIdentifier.getVendor());
            System.out.println("Processor Name: " + processorIdentifier.getName());
            System.out.println("Processor ID: " + processorIdentifier.getProcessorID());
            System.out.println("Identifier: " + processorIdentifier.getIdentifier());
            System.out.println("Microarchitecture: " + processorIdentifier.getMicroarchitecture());
            System.out.println("Frequency (Hz): " + processorIdentifier.getVendorFreq());
            System.out.println("Frequency (GHz): " + processorIdentifier.getVendorFreq() / 1000000000.0);
            System.out.println("Number of physical packages: " + processor.getPhysicalPackageCount());
            System.out.println("Number of physical CPUs: " + processor.getPhysicalProcessorCount());
            System.out.println("Number of logical CPUs: " + processor.getLogicalProcessorCount());


    --- Update ---

    for ram i use this codes

    SystemInfo systemInfo = new SystemInfo();
            HardwareAbstractionLayer hardware = systemInfo.getHardware();
            GlobalMemory globalMemory = hardware.getMemory();
     
            List<PhysicalMemory> physicalMemories = globalMemory.getPhysicalMemory();
            jTextAreaRamBankLabel.setText(null);
            for (PhysicalMemory physicalMemory : physicalMemories) {
                System.out.println(physicalMemory.toString());
     
                jTextAreaRamBankLabel.append("" + physicalMemory.toString() + "\n");
            }


    --- Update ---

    for os info i use this

    SystemInfo systemInfo = new SystemInfo();
            System.out.println(systemInfo);
            OperatingSystem operatingSystem = systemInfo.getOperatingSystem();
     
            System.out.println("Operating System: " + operatingSystem.toString());
            TxtOSName1.setText(operatingSystem.toString() + " bits : " + operatingSystem.getBitness());
     
            System.out.println("Family: " + operatingSystem.getFamily());
            System.out.println("Manufacturer: " + operatingSystem.getManufacturer());
            System.out.println("Number of bits supported by the OS (32 or 64): " + operatingSystem.getBitness());

    for printers
     
    import javax.print.*;
     
     
    PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null);
            System.out.println("Number of print services: " + printServices.length);
     
            for (PrintService printer : printServices) {
                System.out.println("Printer: " + printer.getName());
                jTextArea2.append(printer.getName()+"\n");


    for Audio

     
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.Mixer;
    import javax.swing.filechooser.FileSystemView;
     
     
     
    Mixer.Info[] infos = AudioSystem.getMixerInfo();
            for (int i = 0; i < infos.length; i++) {
                Mixer.Info info = infos[i];
     
                System.out.println(String.format("Name [%s], description - [%s]\n", info.getName(), info.getDescription()));
    //            System.out.println(info.getDescription());
                jTextArea3.append(info.getName()+"\n");
            }
    Last edited by cnmeysam; April 6th, 2022 at 07:04 AM.

  2. #2

    Default Re: get system info

    import oshi.SystemInfo;
    import oshi.hardware.HardwareAbstractionLayer;
    import oshi.software.os.OperatingSystem;

    CPU Temperature
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea1.append(hal.getSensors().toString());

    MotherBoard
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea2.append(hal.getComputerSystem().toString());

    HDD
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea3.append(hal.getDiskStores().toString());

    Displays
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea4.append(hal.getDisplays().toString());

    Graphics
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea5.append(hal.getGraphicsCards().toString());

    Logical Volume
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea11.append(hal.getLogicalVolumeGroups().toString());

    Ram Size
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea12.append(hal.getMemory().toString());

    Network IFs
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea13.append(hal.getNetworkIFs().toString());

    root Pane Check
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea14.append(hal.getNetworkIFs(rootPaneCheckingEnabled).toString());

    PowerSources
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea15.append(hal.getPowerSources().toString());

    Processor
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea16.append(hal.getProcessor().toString());

    Sound Cards
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea17.append(hal.getSoundCards().toString());

    Usb Devices
    SystemInfo si = new SystemInfo();
            HardwareAbstractionLayer hal = si.getHardware();
            jTextArea18.append(hal.getUsbDevices(true).toString());

    Network Params
    SystemInfo si = new SystemInfo();
            OperatingSystem os = si.getOperatingSystem();
            jTextArea19.append(os.getNetworkParams().toString());

    OS Version
    SystemInfo si = new SystemInfo();
            OperatingSystem os = si.getOperatingSystem();
            jTextArea20.append(os.getVersionInfo().toString());
    Last edited by cnmeysam; February 26th, 2022 at 03:56 PM.

Similar Threads

  1. getting system info (cpu, memory, disks etc)
    By Msyhles in forum Java Networking
    Replies: 1
    Last Post: November 18th, 2013, 09:48 AM
  2. Need help with printing out info
    By Diesel298 in forum Object Oriented Programming
    Replies: 4
    Last Post: October 4th, 2013, 12:17 PM
  3. Add debug info
    By user2013 in forum What's Wrong With My Code?
    Replies: 12
    Last Post: July 2nd, 2013, 05:13 AM
  4. Date info
    By deependeroracle in forum Java Theory & Questions
    Replies: 1
    Last Post: March 14th, 2012, 05:36 PM

Tags for this Thread