views:

2242

answers:

8

I prefer to jot down UML-diagrams on paper and then implement them using Java. It would be nice to have a utility which could create UML-diagrams for me which I may share on-line and include in the digital documentation. In other words: I want to create UML diagrams from Java source code.

The utility must be able to:

  • Run in Linux.
  • Handle Generics, i.e show List<Foo> correctly in parameters and return type.
  • Show class inheritance and interface implementations.

It's nice if the utility is able to:

  • Run in Windows and Mac OS X.
  • Display enums in some nice manner.
  • Generate output in a diagram format which I may modify using some other utility.
  • Run from the command line.
  • Restrict the UML generation to a set of packages which I may specify.
  • Handle classes/interfaces which are not part of my source code. It could include the first class/interface which is external in the UML diagram. Perhaps in another color to indicate it being a library/framework created by someone else.
  • Focuses on this task and doesn't try to solve the whole issue of documentation.
+1  A: 

A few monthes ago, I wrote a simple tool named "java2dot". It doesn't handle all you requirements but it might helps.

http://plindenbaum.blogspot.com/2008/10/javadoc-is-not-enough-java2dia.html

Pierre
A: 

Doesn't Eclipse do that with Modelling Tools?

Lucas Jones
A: 

doxygen has almost everything you need.

soulmerge
It does too much I'm afraid. I simply want UML class diagrams. I'll use JavaDoc for the documentation.
DeletedAccount
afaik doxygen does not do UML. (It's more like graphviz custom whatever)
Ronny
@Ronny: No, it's built-in: http://www.doxygen.nl/diagrams.html (despite the page saying doxygen can generate diagrams for c++, I have as well seen diagrams for java generated with it)
soulmerge
it is still not uml.
Ronny
A: 

It's not clear if you want to create code from UML or reverse Engineer code into UML. If you want to create code from UML, the Netbeans UML project type is probably the easiest set of tools for Java.

If you want stand alone

StarUML is an older UML modeling tool. It follow most of the UML guidelines pre 2. It can handle generics, but only if you manually type them in. However, I don't think it correctly generates the generics if I remember correctly. You have to adjust the code after generation.

Although not free, I personnaly think that Umodel is worth the money if you do UML regularly.

jmcecil
I think it was pretty clear. How do you interpret "create a UML class diagram from Java source files"? (It's the headline.) Anyway. StarUML is only for Windows and I want to reverse engineer.
DeletedAccount
i thought it was pretty clear, for what that's worth.
Don Branson
+3  A: 

One method that we've experimented with is a combination of UMLGraph and GraphViz. What we were doing at the time was making the UML creation an automatic part of our CruiseControl build: the javadoc would be built with UML diagrams built in. It is pretty slick.

I think you'll find that the UMLGraph documentation answers pretty much all of your questions. Specifically, you should be able to create the class diagram that you want from the command line.

Bob Cross
+1  A: 

ArgoUML by tigris.org: see here : it's multi-platform. If you prefer a GNU/linux app and you use KDE, you can use Umbrello.

alepuzio
Umbrello is only able to generate UML from C++ files. I might try out ArgoUML, it's page doesn't give specifics about if it supports generics or not.
DeletedAccount
Hi, I read that Umbrello can export Java source from 1.3.1 version (KDE 3.3.1, October 2004). The features are in http://uml.sourceforge.net/feature.php
alepuzio
Well I don't want to export source from UML. I want to create UML from source, which Umbrello only has support for when it comes to C++.
DeletedAccount
Ok, sorry. I haven't well understood :(
alepuzio
-1 for argoUML having no undo and no copy-multiple-objects at once. It is a good tool, but these two things kill it imo.
Ronny
A: 

See http://www.reversejava.com for a dynamic reverse engineering application which generates UML Sequence diagram and view of Participating Class diagram from any Java Application at runtime All you have to do is just run your application and sit back. Reverse Java runs in background tracing all the activities happening inside your application and creates UML diagram for you.

You also have options for, excluding packages,editing the Sequence diagram and exporting the diagrams as PDF or Image.

And its not expensive !

Rajesh Jadhav
A: 

http://www.magicdraw.com/ is java, runs on linux, is able to make uml out of code.

(Better than anything else I tried so far including umbrello, argoUML)

Ronny
why the downvote?
Ronny