Class Diagrammer for Java

Class Diagrammer is a JavaFX desktop application for creating UML class and package diagrams from Java JAR files. Class Diagrammer is © 2010–2016 by Christoph Nahr but available for free download under the MIT license. Aside from my own code, Class Diagrammer also includes David Gilbert’s libraries FXGraphics2D, JFreeSVG, and OrsonPDF.

Overview

Class Diagrammer specializes in so-called “reverse engineering” of Java applications into UML diagrams for documentation purposes. That is, all diagram elements are created by reflecting over the type information found in compiled JAR files. See SampleProject.pdf for some example output.

Basic Features

  • Create UML diagrams whose elements represent arbitrary Java classes or packages. Element contents can be filtered using a variety of display options.
  • Create arbitrary UML relations between elements. Relation layout is adjusted automatically as the connected elements change size or location.
  • Save created diagrams as bitmap images (BMP, PNG, JPEG) or as high-quality vector drawings (HTML/SVG via JFreeSVG, PDF via OrsonPDF).
  • Once you have interactively created a Class Diagrammer project, you can run an included console executable to automatically output the project’s diagrams.

Class Diagrammer projects only store references to JVM names and minimal layout data. The diagram contents are always recreated from the current type information found in the referenced JAR files. The idea is to run your project through the console executable whenever your code changes, e.g. from your build script. With no additional effort on your part, your diagrams are always up-to-date.

Limitations

  • Elements must be based entirely on type information from reverse-engineered JAR files.
  • Relations must be created manually – only their layout is adjusted automatically.
  • You cannot forward-engineer diagrams, i.e. create Java code from diagrams.
  • You cannot add any custom text, drawings, or element contents to diagrams.

Samples

The download packages include a sample project with three diagrams based on Class Diagrammer itself. See SampleProject.pdf (608 KB) for this project’s output. Below is a PNG rendering of the third diagram, showing the classes that define UML relations:

Relation Classes

The sample project uses the default font, Arial. For more examples of Class Diagrammer in action, see the overview diagram for MIME Browser, and the embedded diagrams in the documentation for Star Chess and Tektosyne. Both of these projects use a custom font, Adobe Myriad Pro.

Compatibility

Class Diagrammer relies exclusively on the official Java reflection API to analyze JAR files. It does not use private APIs nor attempt to read JVM byte code directly. I found several free Java diagramming tools that are unusable today because their analysis engines predate the Java SE 5 reflection API, and so resort to low-level tricks that are incompatible with modern Java editions. No such incompatibility should ever happen with Class Diagrammer.

System Requirements

Class Diagrammer requires Oracle JRE 8 Update 66 with JavaFX 8 or later, or an equivalent Java runtime environment. Windows users should consult Oracle Java on Windows to avoid Oracle’s unfortunate default Windows JRE. Please see the following for more information:

  • The ReadMe file contains usage information, the copyright notice, and a feature comparison with the original .NET edition.
  • The WhatsNew file contains the annotated version history of the project, including links to weblog posts with further details on each release.

Copies of the ReadMe & WhatsNew files are included with both download packages. The binary package also includes a comprehensive help file that describes basic concepts as well as usage details.

Download Files

  • Binary & Source Package: version 2.1.0, released on 02 December 2016

Binary PackageDiagrammer.zip (522 KB, ZIP archive)

Class Diagrammer requires no installation. Simply extract the contents to any directory of your liking, then study the enclosed ReadMe file for further instructions.

Source PackageDiagrammerSource.zip (936 KB)

You need NetBeans 8.2 and Oracle JDK 8u112 to load the included project files. The source package also contains a prebuilt Javadoc class reference.

Class Diagrammer for .NET

Class Diagrammer originally targeted the .NET Framework, hence the version number 2.0.0 for the initial Java release. I no longer maintain the .NET edition but you can download the final version here. As with the Java edition, Class Diagrammer for .NET comes in a simple ZIP archive and requires no installation. Direct PDF output in the .NET edition is supported via PDFsharp.

  • Binary & Source Package, Class Reference: version 1.4.6, released on 30 September 2015

Binary PackageDiagrammerNet.zip (532 KB, ZIP archive)

Source PackageDiagrammerNetSource.zip (1.29 MB)

You need either Microsoft Visual Studio (2010 or later) or the free Microsoft Windows SDK 7.1 for Windows 7 and .NET 4 to rebuild Class Diagrammer from source. Windows SDK 7.1 has the same system requirements as the .NET Framework 4 itself but also requires that you first install the full .NET Framework 4 – not just the Client Profile.

Class ReferenceDiagrammerNetClasses.7z (1.94 MB)

Created from XML source code comments using the free Sandcastle Help File Builder. The class reference is a 7-Zip package of loose HTML pages.