Is it possible to generate a global call graph of an application?
Basically I am trying to find the most important class of an application.
I am looking for options for Java.
I have tried Doxy Gen, but it only generates inheritance graphs.
My current script:
#! /bin/bash
echo "digraph G
{"
find $1 -name \*.class |
sed s/\\.class$// |
while read x
do
javap -v $x | grep " = class" | sed "s%.*// *%\"$x\" -> %" | sed "s/$1\///" | sed "s/-> \(.*\)$/-> \"\1\"/"
done
echo "}"
javap -v
and a bit of perl will get you dependencies between classes. You can make your parser slightly more sophisticated and get dependencies between methods.Update: or if you have either a *nix or cygwin you can get a list of dependencies as
Add a header and a footer and you can pass it to dot to render a graph. If you just want to know which classes are used by the most other classes, as your question implies, then