Frequently Asked Questions


The metrics calculated by the program do not agree with those I calculate by hand. How come?

The ckjm program calculates the metrics from the code appearing in the compiled bytecode files. The Java compiler optimizes away some elements of the code (for example static final fields, and these do not take part in the calculations. You may want to consult the disassembled code (using a command like javap -c -private to see what elements ckjm takes into account.

How can I process class files located in a jar file?

See the documentation section titled Using Pipelines to Select Classes.

How can I run the tool in a JDK 1.4 environment?

You can use the open source tool retroweaver to create a backwards-compatible jar file. (Suggested by Paul King).

I'm getting a ClassNotFoundException. How can I fix it?

If you are getting messages like the one below, it means that ckjm can't locate the code for the corresponding classes, in order to properly calculate the depth of the inheritance tree (DIT) metric. java.lang.ClassNotFoundException: Exception while looking for class javax.servlet.http.HttpServlet: Couldn't find: javax.servlet.http.HttpServlet.class To solve this problem you must explicitly setup the java.ext.dirs property pointing to a directory containing the jar files where ckjm can locate those classes. Example: java -Djava.ext.dirs=lib -jar ckjm-1.8.jar *.class

I'm using ckjm in my research. How shall I cite it?

Please cite the following article, which describes ckjm and the rationale of its design.

Diomidis Spinellis. Tool writing: A forgotten art?. IEEE Software, 22(4):9-11, July/August 2005. (doi:10.1109/MS.2005.111)

How can I deal with directory names containing spaces?

It's best to avoid putting spaces in file and directory names, because these can confuse many Unix-related tools that use spaces to separate arguments. If you can't avoid them, here are two tricks for getting around the problem. In a Windows environment use dir /x on the command line to obtain the short (8.3) name of the corresponding directory. On a Unix machine create a symbolic from the directory containing spaces to a directory without spaces, and use that second name:
ln -s '/path/to/directory with spaces/' /tmp/shortname