I need to manipulate control flow graphs for Java code in a project. What might be a good java library to generate control flow graphs in Java. So far I have found a couple eclipse plugins (heavily dependent on eclipse APIs) and standalone tools (cannot embed in my code).

- 730,956
- 141
- 904
- 1,278

- 17,454
- 22
- 87
- 114
-
possible duplicate of [Tool for generating control flow in Java](http://stackoverflow.com/questions/4773858/tool-for-generating-control-flow-in-java) – Midhat Nov 14 '11 at 18:33
3 Answers
A tool to do this stuff is Soot, and this questions is a duplicate of Tool for generating control flow in Java
I'll throw another tool into the mix.
Atlas is an Eclipse plugin that enables program analysis. It has a querable graph database that includes the control flow graph (as well as data flow and other relationships).

- 2,309
- 4
- 34
- 50
jSonde will create sequence diagrams from your actual running code (which is arguably more useful than from source, since source analysis will not show implementation-specific functionality).
javacalltracer does something similar.
Most tools are integrated into Eclipse/similar so they have access to the AST, which makes such things pretty trivial.
It's actually not ridiculously complex to pull the information from byte code yourself (and it's an interesting exercise). Or instrument using AspectJ and create the runtime information yourself.
Edit Original answer, still valid.
JGraph is open-source, and pretty cool.
JDiagram is a Swing component, commercial product.

- 158,873
- 26
- 254
- 302
-
1No I am not looking for a graphs library for java. I am looking to generate control flow graphs from java code. – Midhat Nov 14 '11 at 17:13
-
@Midhat Oh, you mean sequence diagrams. I will update your question. – Dave Newton Nov 14 '11 at 17:21
-
This thing: http://en.wikipedia.org/wiki/Control_flow_graph It is a product of static analysis, I need it before I start running the code. Ad Yes, I am working on these lines, pulling the bytecodes from class files and copnstructing the graphsmyself – Midhat Nov 14 '11 at 17:35
-
@Midhat ... Then my original suggestions, and kaliatech's, are appropriate, since they are general-purpose graphing libraries. I dno't understand the issue any longer. – Dave Newton Nov 14 '11 at 17:40