I'm looking to create a callgraph for java projects from the command line. I have explored several projects, each time falling short (either in my understanding, or the functionality) of what I am aiming for. Some simple guidelines on how to do this would be great, an additional aim is to get a text representation of this graph.
Here is what I have tried:
Call-graph: https://github.com/gousiosg/java-callgraph
This gives me the text output that I want, but I cannot find a way (after looking through the documentation for some time), to turn this into a visual (image file) graph output.
Soot: http://sable.github.io/soot/
After spending a huge amount of time looking through the SOOT documentation, which seems rather difficult to follow, I managed to get SOOT to create bytecode. However, I can't find any guides on how to create a call graph from it. I only see on the main page that it can do this, and I get several email conversations from my google searches, all which are just questions without answers. I'm using the nightly build with the command:
java -cp soot-trunk.jar soot.Main -cp . -pp HelloWorld
Where HelloWorld is the name of my java file, I get an output which is a .class file, but I can't see how to get the actual call graph. This is after following the guide here: https://github.com/Sable/soot/wiki/Running-Soot. When I follow links about visualisations, they seem to be broken links which then redirect back to the homepage. I can see some information about using the -cg flag on the command line page, but can't get anything to work - I just get an option parse error, suggesting an invalid argument: https://ssebuild.cased.de/nightly/soot/doc/soot_options.htm#phase_5
Searching stackoverflow - existing answers I have already looked at several similar questions, such as: Static analysis of Java call graph However, the answers just say "use soot", or "use call-graph", I have been trying these without any luck - although I am closest with the call graph as I do have the text output.
I see some GUI based software and eclipse plugins which claim to create call-graphs, but I am trying to get this working from the command line.
Any help is really appreciated, a guide, or set of commands with either call-graph or Soot, or another program would really help.It may be worth also committing any short tutorial back to them for their documentation as there seems to be more questions than answers when searching.
For reference, I am currently attempting with a very simple class below:
public class HelloWorld {
public static void main(String[] args) {
foo();
}
public static void foo(){
System.out.println("Hello World");
}
}