Parse Java files and generate class diagram as HTML, GraphViz or Text


Samples of output:

Download source code C++ on Github:
Plan to make a Java version available soon

Download Executables:
javatree-mac (OSX executable)
javatree-win64.exe (Windows/VS2015 compiled)

[To Home Page]

Parse Java source files and produce class relationship as HTML, GraphViz or Text file

Javatree help banner

javatree (v1.6)

Des: Generate Java class dependence tree (Dec 30 2017)
Use: Javatree [-+ntgxshjz] header_files...

Switches (*=default)(-=off, +=on): n ; Show alphabetic class name list * t ; Show class dependency tree

Output format (single choice): * g ; Use graphics for tree connections x ; Use (+|-) for tree connections s ; Use spaces for tree connections h ; Html tree connections (needs images 0.png, 1.png, 2.png, n.png) j ; Java tree connections (needs dtree z ; GraphViz (see

Modifiers: Z ; Split GraphViz by tree, use with -O N=nodesPerFile ; Split by nodes per file, use with -O O=outpath ; Save output in file T=tabular ; Tabular html V=filePattern ; Ignore files A=allClasses ; Defaults to public F=full path ; Defaults to relative

Examples (assumes java source code in directory src): javatree -t +n src\*.java ; *.java prevent recursion javatree -x src > javaTree.txt javatree -h src > javaTree.html javatree -h -T src > javaTable.html javatree -j src > javaTreeWithJs.html

-V is case sensitive javatree -z -Z -O=.\viz\ -V=*Test* -V=*Exception* src > javatree -z -N=10 -O=.\viz\ -V=*Test* -V=*Exception* src >

Example test script to generate reports using sample Java code

#!/bin/csh -f

#  Generate test reports

javatree test       > reports/windows.txt
javatree -h test    > reports/html.html
javatree -h -T test > reports/tabular.html
javatree -x test    > reports/text.txt
javatree -t +n test > reports/list.txt
javatree -j test    > reports/tree.html
javatree -z test    > reports/

Sample reports

javatree -h test > reports/html.html

The above html report needs several png images to correctly display the page. The images can be found on the github page inside the reports directory.

javatree -h -T test > reports/tabular.html
Uses jquery table. Links to include jquery script are autogenerated.

javatree -x test > reports/text.txt

javatree -t +n test > reports/list.txt

javatree -j test > reports/tree.html
Needs dtree java script

javatree -z test > reports/
neato -Tpng reports/ > images/directgraph.png

Needs Graphviz to render dot as an image,
See sample graphs of Android class diagrams here