Clarify invocation.

This commit is contained in:
Diomidis Spinellis 2007-05-27 20:17:56 +00:00
parent 0a3d86a0d0
commit b9325a7f93
1 changed files with 42 additions and 14 deletions

View File

@ -20,7 +20,7 @@ You can hide these details from the UML diagram using the <em>javadoc</em>
<code>@hidden</code> tag applied to classes, methods, and fields.
In theory you can also use UMLGraph to reverse engineer existing
Java code.
Note however that UMLGraph is not designed for this purpose;
Note however that UMLGraph was not originally designed for this purpose;
the resulting graphs may be large and unwieldy.
<p />
UMLGraph is implemented as a <em>javadoc</em> doclet (a program satisfying the
@ -29,15 +29,22 @@ generated by the <em>javadoc</em> tool).
<em>Javadoc</em> is part of the Sun JDK, so a typical JDK installation will also
include <em>javadoc</em>.
Before running <em>javadoc</em> you need to place the <code>UmlGraph.jar</code>
file in a location accessible by <em>javadoc</em>
(e.g. the Java class path or the current directory).
You then run <em>javadoc</em> with arguments <code>-doclet gr.spinellis.umlgraph.doclet.UmlGraph</code>
<code>-docletpath /path/to/UmlGraph.jar</code>
and append at the end the file(s) that contain your diagram
specification.
You can of course use any of the <em>javadoc</em> general options;
file in a directory that also contains the Java SDK <code>tools.jar</code> file.
You can accomplish this either by copying UmlGraph.jar to the SDK
<code>lib</code> directory where <code>tools.jar</code> resides,
or by copying the JDK <code>tools.jar</code> file into the directory
where you install UmlGraph.
You then run
<fmtcode ext="sh">
java -jar /path/to/UmlGraph.jar yourfile1.java ...
</fmtcode>
You can use any of the <em>javadoc</em> general options;
<code>-private</code> is usually needed to avoid having to explicitly
specify public elements.
Example:
<fmtcode ext="sh">
java -jar /usr/jvm/java-1.5.0/lib/UmlGraph.jar -private Simple.java
</fmtcode>
<p />
Specifying some packages before the list of source files will designate
those packages as <em>local</em>.
@ -46,22 +53,43 @@ the SVG output UmlGraph generates will contain
local hyperlinks for the local classes
and hyperlinks to the Sun Java API documentation for all other classes.
<p />
Example:
<fmtcode ext="sh">
javadoc -docletpath UmlGraph.jar -doclet gr.spinellis.umlgraph.doclet.UmlGraph -private Simple.java
</fmtcode>
<em>javadoc</em> will create by default a file named <code>graph.dot</code>
in the current directory; option to
this is a text file that can be processed by the <em>Graphviz</em>
in the current directory.
This is a text file that can be processed by the <em>Graphviz</em>
<em>dot</em> program to layout and draw the graph.
A command line like the following will convert the <code>graph.dot</code>
file into Postscript:
<fmtcode ext="sh">
dot -Tps -ograph.ps graph.dot
</fmtcode>
or PNG
<fmtcode ext="sh">
dot -Tpng -ograph.png graph.dot
</fmtcode>
Refer to the <em>dot</em> documentation for information on creating other file formats
or adjusting the UMLGraph output.
<p />
You also can pipe the result of <em>UMLGraph</em> directly into <em>dot</em>:
<fmtcode ext="sh">
java -jar /.../UmlGraph.jar -private -output - Simple.java | dot -Tgif -ograph.gif
</fmtcode>
In the <code>bin</code> directory of the <em>UMLGraph</em> distribution you will
find a Unix shell script and a Microsoft Windows batch file that you can
customize to invoke <em>UmlGraph</em> and <em>dot</em> through a single command.
<p />
Alternatively, you can also run <em>UMLGraph</em> from within <em>javadoc</em>.
This can be useful if your IDE provides additional support for running <em>javadoc</em>.
In this case you run
<em>javadoc</em> with arguments <code>-doclet gr.spinellis.umlgraph.doclet.UmlGraph</code>
<code>-docletpath /path/to/UmlGraph.jar</code>
and append at the end the file(s) that contain your diagram
specification.
Example:
<fmtcode ext="sh">
javadoc -docletpath UmlGraph.jar -doclet gr.spinellis.umlgraph.doclet.UmlGraph -private Simple.java
</fmtcode>
<p />
Note that when you use <em>dot</em> for generating SVG diagrams your
should specify the <code>-outputencoding UTF-8</code> option to UMLGraph.
This option will correctly render the stereotype guillemot characters