Here is a open source project I created on google code [+JAVASHOT+|http://code.google.com/p/javashot/] which generates .dot files for an executing Java program. Those files can be viewed by the tools from graphviz .
Your feedbacks are welcome.
Thanks.