-
You can specify a range of modification times for the files.
As an example, the following command will print the metrics of
the class files modified during the last week.
find build -name '*.class' -mtime -7 -print | java -jar /usr/local/lib/ckjm.jar
-
You can filter out specific patterns, either with the GNU
find's regular expression options, or by piping its results
through grep.
As an example, the following command will not print metrics for
internal classes (their name contains a $ character).
find build -name '*.class' | fgrep -v '$' | java -jar /usr/local/lib/ckjm.jar
-
You process contents from several directories.
As an example, the following command will process the class files
located in the build and lib directories.
find build lib -name '*.class' -print | java -jar /usr/local/lib/ckjm.jar
-
You generate the list of class files, by processing the list of
contents of a jar file.
The following example will calculate the metrics for all class files
located in the file ant.jar (the sed step prints only the lines
ending in .class, replacing the beginning of the line with the name of the
jar file, ant.jar.
.
jar tf ant.jar |
sed -n '/\.class$/s/^/ant.jar /p' |
java -jar /usr/local/lib/ckjm.jar
- You can also combine the above patterns (and more)
into more sophisticated file location and selection options.
The following example, will process the classes of
all jar files located in the lib directory.
for i in lib/*.jar
do
jar tf $i |
sed -n "/\.class$/s,^,$i ,p"
done |
java -jar /usr/java/ckjm-1.3/build/ckjm-1.3.jar
(Replace the sequence /usr/java/ckjm-1.3/build/ckjm-1.3.jar
with the actual path and filename of the ckjm version you are using.)