Skip to content
jezhumble edited this page Sep 13, 2010 · 35 revisions

JavaSysMon is designed to provide an OS-independent way to get live system information such as CPU and memory usage, distributed as a single jar file. It is written in C and Java. However the C is hidden away inside the jar (thanks to one-jar), so you never need to worry about it.

Currently it supports Mac OS X, Linux, and Windows. Support for Solaris is planned next. Ultimately we aim to support everything from AIX to Android.

Get started

Run ant, and then:

java -jar target/javasysmon.jar

Using the library from code

Simply put the jar in your classpath, and use it like this:

import com.jezhumble.javasysmon.JavaSysMon;
JavaSysMon monitor = new JavaSysMon();
float cpuUsage = monitor.cpuUsage();
long totalMemory = monitor.totalMemory();
long freeMemory = monitor.freeMemory();
long totalSwap = monitor.totalSwap();
long freeSwap = monitor.freeSwap();
int numCpus = monitor.numCpus();
long cpuFrequency = monitor.cpuFrequency();

Current support

  • Currently only supports Mac OS X, Linux, and Windows
  • Supports Java 1.4 and above

License

JavaSysMon is BSD licensed.

Clone this wiki locally