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"); }