First, let me introduce to you an open source tool Sigar
Official website: http://sigar.hyperic.com/
API: http://www.hyperic.com/support/docs/sigar/index-all.html (Since it is in English, if you are not good at English, you can use the translation function of Google Chrome to directly convert it to simplified Chinese for reading)
Sigar (System Information Gatherer And Reporter) is an open source tool that provides a cross-platform system information collection API implemented in C language. Information that can be collected includes:
1 CPU information, including basic information (vendor, model, mhz, cacheSize) and statistical information (user, sys, idle, nice, wait)
2 File system information, including Filesystem, Size, Used, Avail, Use%, Type
3 Event information, similar to Service Control Manager
4 Memory information, total number of physical memory and swap memory, usage number, remaining number; size of RAM
5 Network information, including network interface information and network routing information
6 Process information, including memory, CPU usage, status, parameters, and handles of each process
7 IO information, including IO status, read and write size, etc.
8 Service status information
9 System information, including operating system version, system resource limitations, system running time and load, JAVA version information, etc.
First of all, we need to download the sigar package. The package name I downloaded is: hyperic-sigar-1.6.4
During our operation, we must first prepare
1. Copy the log4.jar and sigar.jar packages into lib (if we only do this step and start running the program, the following situation will occur [under windows operating system])
Solution:
Copy the sigar-x86-winnt.dll file to the bin directory of jdk in this java
The above is the full content of the quick solution to the problem encountered by using sigar in Java. I hope everyone can support Wulin.com~