Install-Software "PlantUML"

Install the network diagram drawing tool "PlantUML" on Windows.

Page content

Introduction

This article explains how to install the network diagram drawing tool PlantUML on Windows. It focuses on setting up the environment to run PlantUML from the CLI (Command Line Interface). It does not cover using PlantUML as a VS Code extension.

Prerequisites

Installation

This section outlines how to install PlantUML . The goal is to prepare an environment where you can run the following command:

  • java -jar plantuml.jar -verbose sequenceDiagram.txt

Follow these steps to set up the environment:

  1. Install Java 8 (JRE8: Oracle.JavaRuntimeEnvironment)
  2. Install Graphviz
  3. Download the plantuml.jar file

1. Install Java 8 (JRE 8)

Launch PowerShell with administrator privileges:

  1. Open the START MENU and type pwsh
  2. Click “Run as administrator”

Check the latest available version:

winget search --id Oracle.JavaRuntimeEnvironment -e
Name    Id                             Version      Source
------- ------------------------------ ------------ -------
Java 8  Oracle.JavaRuntimeEnvironment  8.0.4510.10  winget

To install, use the verified ID and Source as shown below:

winget install --id Oracle.JavaRuntimeEnvironment --source winget -e

Add the following path to your system environment variables PATH (note: the directory name will vary depending on the version you installed):

"C:\Program Files\Java\jre1.8.0_451\bin"

To verify the installation, close PowerShell and reopen it with administrator privileges. Run the command below to confirm the path is correctly set:

java -version

Example output:

java version "1.8.0_451"
Java(TM) SE Runtime Environment (build 1.8.0_451-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.451-b10, mixed mode)

2. Install Graphviz

Follow the guide below to install Graphviz and add its executable path to your system environment variable PATH:

3. Download the plantuml.jar File

Download the plantuml.jar file from the following site (SourceForge ):

By default, the file will be saved to your “Downloads” folder:

Get-ChildItem -Path ~/Downloads/plantuml/
    Directory: C:\Users\WDAGUtilityAccount\Downloads\plantuml

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           3/17/2025  9:46 PM       11196866 plantuml.jar

Move the plantuml.jar file to a preferred location. For example, you can create a bin/plantuml directory in your home folder and move it there:

New-Item -Path ~/bin/plantuml -ItemType Directory
Copy-Item -Path ~/Downloads/plantuml/plantuml.jar -Destination ~/bin/plantuml/
Unblock-File -Path ~/bin/plantuml/plantuml.jar
Remove-Item -Path ~/Downloads/plantuml -Recurse -Force
# test path
Get-Item -Path ~/bin/plantuml/plantuml.jar
    Directory: C:\Users\<username>\bin\plantuml

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           3/17/2025  9:46 PM       11196866 plantuml.jar

Installation complete.

Sample Code

Let’s generate and visualize a basic sequence diagram.

1. Create a PlantUML-format Text File

First, create a PlantUML-format text file named sequenceDiagram.txt:

@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
@enduml

This file defines a simple sequence diagram.

2. Generate the Diagram Using the java Command

Next, generate the diagram using the java command. Navigate to the folder containing your text file and run the command below:

# change directory
Set-Location -Path path/to/the/sequenceDiagram.txt
# execute plantuml command
java -jar C:\Users\<username>\bin\plantuml\plantuml.jar -verbose sequenceDiagram.txt
## Replace <username> with your actual Windows username.
## Press <TAB> after typing ~/bin/plantuml/plantuml.jar for autocompletion

This command takes sequenceDiagram.txt as input and generates a PNG image file (sequenceDiagram.png). The -verbose flag outputs logs. If the image isn’t generated, check the logs for issues.

3. Check the Generated Diagram

After executing the command, open the sequenceDiagram.png file and confirm that the diagram was created correctly:

Get-Item -Path sequenceDiagram.png
    Directory: C:\Users\WDAGUtilityAccount

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           4/20/2025  8:08 PM           1861 sequenceDiagram.png
Invoke-Item -Path sequenceDiagram.png
Output from sequenceDiagram.txt: A sequence diagram.

Terms

Graph (Network Diagram)

A “graph” here refers to a relationship diagram that connects “nodes” using “arrows” or “lines.” It is distinct from charts like bar graphs or line charts.

PlantUML

An open-source graph visualization tool. Like Graphviz , it uses a text-based syntax to define diagrams. The key differences lie in the syntax and the variety of diagrams supported. PlantUML supports more types of diagrams than Graphviz .