Reverse Engineering Sequence Diagram from Java Source Code

November 10, 2014 Views: 106,003 PDF Link Compatible edition(s): Professional, Standard

Since source code is in text form, it is complex and is hard for human to read or analyze, especially when the logic is complicated and involves a large number of classes. "A picture is worth a thousand words", by visualizing source code with diagram, you can easily realize the classes involve as well as their relationship in run time. In order to help you with that, Visual Paradigm enables you to reverse your Java source code into UML sequence diagram, so that you can gain a better understanding of Java source code by reading diagram instead of looking to a possibly thousand lines of source code. This is very beneficial for both analysis and communication.

  1. Download of this tutorial and extract the zip file to any directory.
  2. Study the source code. Read the register method in to see how it works.
    01 java source code
  3. Create a new project by selecting Project > New from the application toolbar. In the New Project window, enter Account Registration as project name and click Create Blank Project.
    new project
  4. Select Tools > Code > Instant Reverse Java to Sequence Diagram... from the toolbar.
  5. In the Instant Reverse Java to Sequence Diagram window, click on Add Source Folder... button.
  6. Select the extracted source folder src. Click Next button.
  7. Select the method to visualize. Select src > > register (String,int). Click the Next button.
    03 instant reverse java to sequence diagram
  8. You need to select a diagram to visualize the interaction. The Create new sequence diagram option is selected and diagram name is entered by default. Click Finish button.
    04 create new sequence diagram
  9. As a result, a UML sequence diagram is formed. Let's study the diagram.
    sequence diagram formed
    When a person invokes RegisterController's register method (message: 1), it creates an account object (message: 1.1). After that, the controller sets the id, name and age to the account object (message 1.2, 1.3, 1.4) and adds itself to the account list (message: 1.5). The invocation ends with a return (message 1.6).

Related Links

  1. Instant reverse Java sources to sequence diagram
  2. Why Aren't There Any Operations to Choose from in Reverse Engineering of Sequence Diagram?



You may be interested in

  1. Functional Modeling with Data Flow Diagram Tutorial
  2. Writing Effective Use Case
  3. Data Flow Diagram: Examples - Food Ordering System
  4. Modeling Relational Database Design with ERD
  5. Process Improvement with As-Is and To-Be Analysis
Tags of this article:

Comments (27)

written by Carlos on May 9, 2014

Not working, it does not display the operations to select. I use 11.1

written by Jick Yeung (VP) on May 12, 2014

Hi Carlos,

Thank you for your post. Would you mind submitting a ticket to us, so that we can perform a detailed checking with you? You can submit a ticket at:

If possible, please submit your source code. If not, please provide us with some screenshots regarding your selecting in the various screens that prompted during the reverse engineering process.

Look forward to hearing from you.

written by Ewout Van Gossum on May 17, 2014

I'm using an academic license of 10.2, and I'm having the same problem as Carlos. I submitted a ticket with a screenshot here:

written by mr_problem on August 2, 2014

having the same problem as carlos

written by D. Singh on August 6, 2014

I have same issue. It does not show operations/functions to select from java class which seems like a very basic functionality.

written by Jick Yeung (VP) on August 8, 2014

Hi mr_problem and D. Singh,

Please make sure you have properly selected the root folder of source files. If you are sure you have made it right, please submit a ticket by attaching a screenshot of your folder structure, and your folder selection in the Reverse window. You can submit a ticket at:

written by Sandy on December 23, 2014

I'am also having this isssue. The "+" sign next to the source file is not displayed.

written by Sourena on January 8, 2015

This feature does not work!

written by Jick Yeung on January 15, 2015

Hi Sourena,

We are sorry to know about this. Could you tell us more about the problem? What did you do and did you see any warning/message message?

written by Sourena on January 15, 2015

No, just like some other people said already, on the select operation dialog the plus icon never showed up and therefore I could not select any java files to generate the graph from.

written by Sourena on January 15, 2015

I have an idea why this may be the case, the code I was trying to generate a sequence diagram from was both threaded and annotated which means it was calling a service method from its run() method which in turn invoked the service by passing the ClassX.class reference to a generic getService() method and then once that was resolved then the actual method was called so I though the sequence diagram generator code may not be smart enough to recognize this case since it's not a straightforward function call like: ClassXInstance.Method1(param1). Hope this helps since I cannot share actual code!

written by James Hamilton on January 23, 2015

Having the same problem: no plus sign to select an action with. In my case I am using the ConstantContact API, which is available from GitHub:

Trying to reverse a sequence diagram from the ConstantContact class

written by Jick Yeung (VP) on January 23, 2015

Thanks everyone. I have forwarded all your feedback to our team to study. When there is any finding I will post here.

written by Jick Yeung (VP) on January 23, 2015

Thanks everyone. I have forwarded all your feedback to our team to study. When there is any finding I will post here.

written by Jick Yeung (VP) on January 23, 2015

Hi James,

The problem could be caused by file encoding. How did you get the file? Did you get that from GIT, or by copying the code and pasting it to a file, saving it manually in the text editor?

written by James Hamilton on January 23, 2015

I got it from git

written by Jick Yeung (VP) on January 23, 2015

Is your GIT set to use default system encoding? We found that default system encoding is needed.

written by Sourena on January 24, 2015

Encoding should not be an issue because other diagrams such as class diagrams and package diagrams are generated without any issues, why is it an issue with the sequence diagram?

written by Jick Yeung (VP) on January 26, 2015

Hi Sourena and James,

Could you send us your log file for checking? You can export it from the About window (Help > About Visual Paradigm...). And James, if possible could you send us the file "ConstantContact" for checking?

You can send us the file by submitting a ticket at:

written by subhashish on February 24, 2015

Is there a way to ignore certain package stems (e.g. java.util) or only include certain package stems (e.g com.mycompany) while reverse engineering to generate sequence diagram?
I got VP to generate a pretty nice diagram but would want to remove calls to 3rd party framework and java classes.

written by Subhashish on February 24, 2015

Found an option via "Diagram content" --> "Show/Hide" ---> "Show/Hide diagram elements". That'll do as a workaround.

written by Amir on July 27, 2015

It just work for this example, any change, not work.

I have this error message
(Selected operation not found. You may have selected a wrong source folder.)

You may , ahhahahahaha. this is the job of programmers, when the are not so sure about the action of a code, they will try to System.out.println("You may have.....");

written by Jick Yeung (VP) on July 27, 2015

Dear Amir,

Thank you for your post. Please read the following page for solution:

If it remains not working, could you create a ticket to our team with your source files attached, along with a screenshot showing your folder selection? You can create ticket at:

Best regards,
Jick Yeung

written by Vik on August 11, 2015

Hi Jick Yeung,

I have faced the same issue with Android source this day. I downloaded the 30 day evaluation. From that I used the enterprise edition version.

With Android Studio 1.3 if you create a simple blank Activity project then it will create a gradle project.
The project structure example is written in the section 3.2 :

All the java class source files in my case are not containing that 2 level hierarchy in default. Here I mean "/main/java" under the src folder.

This is what is generated by the studio in the java source files: "package com.example.vik.visualparadigmexample;"

My suggestion is that your application is missing that 2 folder level "/main/java".
I created a temporary folder without that 2 hierarchy folder level and the import worked fine.

The same goes for the junit test folder which can have different names like: "src/tests/java", "src/androidTest/java", etc.

I hope this helps you for your team.


written by Jick Yeung (VP) on October 2, 2015

Hi Vik,

Sorry for my late reply. Honestly I am not familiar with Android Studio. Having read your reply I downloaded it and gave it a try. I found a Java class I created in the tool being stored at:

So I think you can reverse your code by selecting the 'java' as the source folder.

Best regards,
Jick Yeung

written by Ravi Kalla on December 18, 2015

When I am creating sequence diagrams for a project implemented in Spring, objects that are autowired are not included as part of the sequence diagram. Only interfaces are included in the diagram. Is there a solution for this?

written by khan on July 17, 2016

its working thank you so much ,,,,,,,,,,,

Write comment


Enter the calculation result

security code