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 native binaries are hidden away inside the jar (thanks to one-jar), so you never need to worry about them.

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.

If you’re interested in adding support for a new platform, check out Adding support for a new platform.

Download latest

The current version of JavaSysMon is 0.1, released December 19th. You can get it here

Run it with java -jar

Building and running

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 and limitations

  • Currently only supports Mac OS X, Linux, and Windows
  • Supports Java 1.4 and above
  • CPU speed doesn’t work on Windows, and only works for Intel CPUs on Linux

License

JavaSysMon is BSD licensed.

Clone this wiki locally