Operation

To run ckjm you must run java with the -jar flag, providing as its argument the location of the file ckjm.jar. Next, you can specify as arguments the Java class files you want to analyze.
Example:
java -jar /usr/local/lib/ckjm_ext.jar build/classes/gr/spinellis/ckjm/*.class
(Replace the sequence /usr/local/lib/ckjm-1.5.jar with the actual path and filename of the ckjm version you are using.)

The command's output will be a list of class names (prefixed by the package they are defined in), followed by the corresponding metrics for that class: WMC, DIT, NOC, CBO, RFC, LCOM, Ca, Ce, NPM, LCOM3, LOC, DAM, MOA, MFA, CAM, IC, CBM and AMC . In lines where at the begining is "~" is the value of CC. CC is counted for all methods in given class.

test.TestClass  3 1 0 1 8 1 1 1 1 0.0000 115 0.0000 0 0.0000 0.5556 0 0 37.0000
~ void m2(): 6
~ public void <init>(): 1
~ void m1(): 7

test.TestClass2 5 1 0 1 11 4 1 1 0 0.4167 53 0.3333 1 0.0000 0.6250 0 0 9.0000
~ int m3(int jk): 1
~ void <init>(): 1
~ void m2(): 1
~ static void <clinit>(): 1
~ void m1(): 2

If the classes are located in a jar archives, you can specify the archive name instead of filenames of Java classes. You can also specify several jar (or class) names separated with the semicolon (';').

java -jar /usr/local/lib/ckjm_ext.jar 'ant-jai.jar;bcel.jar'

If you specify neither jars nor classes to analyse ckjm will prompt you to type some.

Finally, instead of specifying the classes to be analyzed as the command's arguments, you pass them (as class files, or as jar file, class file pairs) on the command's standard input. The following example will process all class files located in the build directory.

find build -name '*.class' -print | java -jar /usr/local/lib/ckjm_ext.jar

The program, by default, will not take into account classes that belong to the Java SDK packages. The command-line option switch -s, can be used to enable this processing.

You can take into consideration only public method by setting the command-line option switch -p. By default, all methods are taken into account.

The command-line option switch -x will change the output format to xml. By default, it is plain text as in the above example.
Example:

java -jar /usr/local/lib/ckjm_ext.jar -x build/classes/gr/spinellis/ckjm/*.class

Please note that the program may report a ClassNotFoundException. It usually happens when the investigated classes depends on some libraries. In order to solve the issue, the dependencies should be added to the classpath. Detailed guide regarding classpath configuration is available here.