• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Programs to make graph of Netbeans classes

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a large Java project in Netbeans. I would like to know of the names of any programs (and URLs) that I can use which will create a diagram of all the class interactions?

Which is the best program, why?
Are there any free and how do they compare to the other programs?

Thank you
 
Saloon Keeper
Posts: 27718
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Michael!

You can tell what programs are in a Java application project by doing a test scan for "main(" using grep or some similar text utility. That will indicate the main class(es) of the application. For a non-app project such as a webapp, there is no main program, but in such a case, you'd be looking for servlets and JSPs.

Getting a general graph of your classes and interactions may be a bit more challenging. There may be some IDE plugins, but one thing that will do the job is a reverse-engineering UML tool. ArgoUML is an open-source UML designing and graphing tool that I like.

One caution, though, a tool like ArgoUML doesn't understand the difference between major functional components and trivial ones. So if you turn it loose on a project, you're likely to get acres and acres of class diagrams with no obvious way to spot the major players. That's a general fault of UML diagramming and it's probably one of the reasons why UML was such a big fad back around Y2K and yet now is rarely heard of. It produced a lot of cubicle wallpaper but not much in the way of productivity.

Actually a good way in Java is to run the JavaDoc tool on the project. This is often possible using a top-level menu in a lot of IDEs. JavaDoc by default will produce a hyperlinked website of all the classes and public properties of a project that you can then view using your web browser. A really good project will have detailed explanations of what every class and method is good for and you can even have manual pages, tables and graphics in it. More likely you're only going to see just the names of classes and properties, but that's still better than nothing. From experience, however, I can state that you cannot learn a technology from most JavaDocs. Not even the Sun ones. You really need some sort of functional documentation as well and that, alas, will depend on how diligent the original development team was.
 
Michael Cakes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you think about PlantUML? I know nothing about it. Is it better than ArgoUML?

I've been told not to use a paint program. I could use Visio, but ArgoUML or PlantUML might be better. Which would you use?

Thank you
 
Tim Holloway
Saloon Keeper
Posts: 27718
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a new one on me. Just from a superficial scan, though, it looks more like a design tool where you define the classes and it diagrams them rather than being able to reverse-engineer existing code. Though someone who's into JavaDoc customization could probably hack together a bridge.

ArgoUML and its commercial twin, Poseidon, haven't seen much maintenance in recent years last time I checked, but while ArgoUML could benefit from some additional bells and whistles, it's pretty decent considering that IBM's Rational Rose was something like $2500 a seat.
 
Michael Cakes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With ArgoUML, can you automatically create a graphical representation from a Netbeans project? If so what are the steps to do this?

Or, do I have to do things like create every class box manually by repeatedly clicking on the class box icon, placing it, etc?

Thanks
 
Marshal
Posts: 4473
569
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michael Cakes wrote:What do you think about PlantUML? I know nothing about it. Is it better than ArgoUML?


I use PlantUML (which uses Graphviz under the covers), and they are great tools for producing graphs from plain-text machine-generated source, but they do not do the actual reverse engineering themselves.  Maybe look at jdeps or one of the other JDK tools to help with that.


 
Marshal
Posts: 28141
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michael Cakes wrote:What do you think about PlantUML? I know nothing about it. Is it better than ArgoUML?

I've been told not to use a paint program. I could use Visio, but ArgoUML or PlantUML might be better. Which would you use?



You seem to be only concerned about the tool used to display the graph. And you seem to leaning towards UML diagrams.

Whereas your description to me looks like "Program X uses classes java.time.format.DateTimeFormatterBuilder and java.io.Reader and java.lang.Iterable and org.apache.common.CSVRecord ... " all extended recursively until there's no other classes to include, then putting all of them into an ordered graph to be displayed. No doubt if you had the compiled code then, using reflection, you could build that graph. But am I misunderstanding your requirements?
 
Michael Cakes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a quote from the PlantUML FAQ page:

PlantUML is a text-based tool, which means that you can create diagrams by writing sentences in a simple, human-readable language.



So, it seems that instead of directly using Java source code to produce a diagram, PlantUML requires the use of English sentences to produce good diagrams.

Thank you
 
Tim Holloway
Saloon Keeper
Posts: 27718
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That was my understanding as well. If PlantUML is using Graphviz, Graphviz is based on a "graphics language" itself and incidentally, I use it a lot, although generally for things like graphing out my network. It's very powerful, though.

One thing I like about Visio is that it's intensively object-oriented, so you can hang custom attributes off of shapes (for example a server's IP addresses). But here again, you'd need to script something to extract what you need from Java code and create/link/layout the Visio shapes. Graphviz, incidentally, automatically lays out the shapes, although rarely exactly to my standards of beauty. Close enough that I can generally tweak it, though.

For out-of-the-box UML graphing, ArgoUML is probably your best bet based on what we know so far.
 
Ron McLeod
Marshal
Posts: 4473
569
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I looked at jdeps for a few minutes and it does trace the dependencies and can directly produce a dot file which can be visualized with Graphviz, however as the complexity goes up, the usefulness of the diagram drops.  Maybe there is a way to optimize things (like grouping by package names) - I didn't spend the time to see what might be possible.

Here's what I found with a jar that I am working on ...

I ran the command line: jdeps -v --dot-output /tmp/ sgp23-testdata-1.0.0.jar

That produced a file with the following contents (I chopped-out the middle for compactness):
Graphviz rendered this (this is zoomed-out and unreadable):


Here's a zoomed-in portion if the diagram:


Click here for a more readable SVG image of the graph
 
Michael Cakes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I try to download ArgoUML from here, I get the attached error message.

What should I do?

Thank you,
Download-Failed.png
[Thumbnail for Download-Failed.png]
 
Tim Holloway
Saloon Keeper
Posts: 27718
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There used to be a Java feature that would dynamically download and cache Java apps automatically. ArgoUML used it, and I liked it, but it is no longer supported by Oracle. I think you've activated the stubby remainder and that's why it goes nowhere. You'll need to download and run the ArgoUML JAR file directly.

Fair warning. You won't get much better charting with ArgoUML than you did with GraphViz. There is no convention in UML for organization by Java package and the main difference is going to be that those little ovals (which you can re-define as other shapes using Graphviz option) will turn into rectangles that list the properties and methods. So even more complex.

As I said, UML made for great cubicle wallpaper, but the tools are rather unsubtle.
 
Paul Clapham
Marshal
Posts: 28141
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michael Cakes wrote:When I try to download ArgoUML from here, I get the attached error message.



I got "503 Service Temporarily Unavailable" when I clicked on that link. So I guess you have to wait until it becomes available.
 
Tim Holloway
Saloon Keeper
Posts: 27718
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Michael Cakes wrote:When I try to download ArgoUML from here, I get the attached error message.



I got "503 Service Temporarily Unavailable" when I clicked on that link. So I guess you have to wait until it becomes available.



I just checked the site. It's hung up at the moment. The option that no longer works is "Java Web Start".
 
Tim Holloway
Saloon Keeper
Posts: 27718
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As an alternative, try pulling the source and building locally: https://github.com/argouml-tigris-org/argouml It's a Maven-built project.

I see that at some point, ArgoUML has attempted to move beyond Java and add a plethora of new functions and languages. Probably not entirely successfully, but it's interesting to see.
 
Michael Cakes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:As an alternative, try pulling the source and building locally: https://github.com/argouml-tigris-org/argouml It's a Maven-built project.

I see that at some point, ArgoUML has attempted to move beyond Java and add a plethora of new functions and languages. Probably not entirely successfully, but it's interesting to see.



At the top of that webpage, there is a link to 24 issues.
 
Ron McLeod
Marshal
Posts: 4473
569
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's wind-back to your original post ...

Michael Cakes wrote:I have a large Java project in Netbeans. I would like to know of the names of any programs (and URLs) that I can use which will create a diagram of all the class interactions?


   - It sounds like the project already exists (not creating something now) - is that correct?

   - When you say large java project, about how many classes would that be?

   - What do you hope to gain from graphing the classes and their relationships?  Are you trying to better understand the structure of the project?

   - Will this be a one-time effort, or do you imagine that you will trying to keep the diagram up-to-date after changes are made?
 
Michael Cakes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:Let's wind-back to your original post ...

Michael Cakes wrote:I have a large Java project in Netbeans. I would like to know of the names of any programs (and URLs) that I can use which will create a diagram of all the class interactions?


   - It sounds like the project already exists (not creating something now) - is that correct?

   - When you say large java project, about how many classes would that be?

   - What do you hope to gain from graphing the classes and their relationships?  Are you trying to better understand the structure of the project?

   - Will this be a one-time effort, or do you imagine that you will trying to keep the diagram up-to-date after changes are made?



1. Project already exists
2. 5,000+ classes
3. Trying to understand the structure of the project
4. Don't know
 
Michael Cakes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The User Manual seems to say that the main menu option "Generation/Generate All Classes" will generate the class diagram from  Java source code?

Once I get ArgoUML installed, is this the best I can do?

Thanks
 
Ron McLeod
Marshal
Posts: 4473
569
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have never used Argo, but I would assume that Generation/Generate All Classes will generate .java files based on the UML representation (forward-engineering, not reverse engineering).
 
Ron McLeod
Marshal
Posts: 4473
569
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if this is what you are wanting, but I have used Enterprise Architect to produce class diagrams like this from existing source code:



I bought my copy quite a while ago and have never updated it, so I don't know what the current price might be.  They used to have free 30-day trials, so if that still available, maybe give that a try and see if it gives you what you want.  I don't know how helpful a the reverse-engineered diagrams will be to understand what you have.  If the source is organized decently, then just reading through the code might be a better option.
 
Ron McLeod
Marshal
Posts: 4473
569
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:I have never used Argo, but I would assume that Generation/Generate All Classes will generate .java files based on the UML representation (forward-engineering, not reverse engineering).


I just took a quite look at the documentation - it seems like reverse-engineering is done using Import/ Import Sources
 
Michael Cakes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:I have never used Argo, but I would assume that Generation/Generate All Classes will generate .java files based on the UML representation (forward-engineering, not reverse engineering).



You are correct. After reading the user manual closer, it explicitly says that code will be generated from the diagram.
 
Tim Holloway
Saloon Keeper
Posts: 27718
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michael Cakes wrote:

Tim Holloway wrote:As an alternative, try pulling the source and building locally: https://github.com/argouml-tigris-org/argouml It's a Maven-built project.

I see that at some point, ArgoUML has attempted to move beyond Java and add a plethora of new functions and languages. Probably not entirely successfully, but it's interesting to see.



At the top of that webpage, there is a link to 24 issues.



Well, yes. It's the development source archive. I'd be worried if there were no issues, since no software is ever perfect, The point of "issues" is to point out what needs fixing/improving for the developers.

The reverse UML diagrams rendered by ArgoUML will closely resemble Ron's example, teven though it's a different product. It's still UML, after all.
 
Michael Cakes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, Enterprise Architect can be used to reverse engineer Java class diagrams from dot jar files.
 
Ron McLeod
Marshal
Posts: 4473
569
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes - it can reverse-engineer .java source and .jar archive files.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic