-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.
java -jar /usr/local/lib/ckjm-1.5.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 2 8 1 2 1 1 0,0000 115 0,0000 0 0,0000 0,5556
~ 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
~ 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 as a single argument the ';' separated names of the jar archive, followed by a space, followed by the name of the class in the archive.
java -jar /usr/local/lib/ckjm.jar 'ant-jai.jar;bcel.jar'
Finally, instead of specifying the classes to be analyszed 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.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.
Contents | « Previous Next (Using Pipelines to Select Classes) » |