Creating class diagrams of Java source elements

You can create class diagrams of existing Java™ source elements, including projects, packages, classes, and interfaces, to visually represent and develop structures and relationships in applications.

Before you begin

You must be in the Package Explorer view or have a class diagram open.


  1. In the Package Explorer view or in the diagram editor, right-click a source element or selected source elements; then click Visualize and complete one of the following steps:
    • To add the selected elements to the new diagram, click Add to New Diagram File > Class Diagram.
    • To add the selected Java project or packages and their contents to the new diagram, click Add Elements and Contents to New Diagram > Class Diagram.
  2. In the New Class Diagram wizard, in the Enter or select the parent folder field, specify the parent folder.
  3. In the File name field, type a file name.
  4. Optional: To enable the associated capabilities, click Next and complete the following steps:
    1. Select the Customize UI visibility for this diagram by selecting capabilities below check box.
    2. From the Capabilities list, expand a category and select the capabilities.
  5. Click Finish.


A class diagram is created and opens in the diagram editor with the selected source elements and contents in it.
Tip: If any selected source elements are Java 2 Platform, Standard Edition (J2SE) 5.0 classes with annotations, the details of the annotations are shown in the annotation compartments of the classes in the diagram. You can also add or edit annotations in the Properties view on the Annotation page .