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. <code>@hidden</code> tag applied to classes, methods, and fields.
In theory you can also use UMLGraph to reverse engineer existing In theory you can also use UMLGraph to reverse engineer existing
Java code. 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. the resulting graphs may be large and unwieldy.
<p /> <p />
UMLGraph is implemented as a <em>javadoc</em> doclet (a program satisfying the 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 <em>Javadoc</em> is part of the Sun JDK, so a typical JDK installation will also
include <em>javadoc</em>. include <em>javadoc</em>.
Before running <em>javadoc</em> you need to place the <code>UmlGraph.jar</code> Before running <em>javadoc</em> you need to place the <code>UmlGraph.jar</code>
file in a location accessible by <em>javadoc</em> file in a directory that also contains the Java SDK <code>tools.jar</code> file.
(e.g. the Java class path or the current directory). You can accomplish this either by copying UmlGraph.jar to the SDK
You then run <em>javadoc</em> with arguments <code>-doclet gr.spinellis.umlgraph.doclet.UmlGraph</code> <code>lib</code> directory where <code>tools.jar</code> resides,
<code>-docletpath /path/to/UmlGraph.jar</code> or by copying the JDK <code>tools.jar</code> file into the directory
and append at the end the file(s) that contain your diagram where you install UmlGraph.
specification. You then run
You can of course use any of the <em>javadoc</em> general options; <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 <code>-private</code> is usually needed to avoid having to explicitly
specify public elements. specify public elements.
Example:
<fmtcode ext="sh">
java -jar /usr/jvm/java-1.5.0/lib/UmlGraph.jar -private Simple.java
</fmtcode>
<p /> <p />
Specifying some packages before the list of source files will designate Specifying some packages before the list of source files will designate
those packages as <em>local</em>. those packages as <em>local</em>.
@ -46,22 +53,43 @@ the SVG output UmlGraph generates will contain
local hyperlinks for the local classes local hyperlinks for the local classes
and hyperlinks to the Sun Java API documentation for all other classes. and hyperlinks to the Sun Java API documentation for all other classes.
<p /> <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> <em>javadoc</em> will create by default a file named <code>graph.dot</code>
in the current directory; option to in the current directory.
this is a text file that can be processed by the <em>Graphviz</em> This is a text file that can be processed by the <em>Graphviz</em>
<em>dot</em> program to layout and draw the graph. <em>dot</em> program to layout and draw the graph.
A command line like the following will convert the <code>graph.dot</code> A command line like the following will convert the <code>graph.dot</code>
file into Postscript: file into Postscript:
<fmtcode ext="sh"> <fmtcode ext="sh">
dot -Tps -ograph.ps graph.dot dot -Tps -ograph.ps graph.dot
</fmtcode> </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 Refer to the <em>dot</em> documentation for information on creating other file formats
or adjusting the UMLGraph output. or adjusting the UMLGraph output.
<p /> <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 Note that when you use <em>dot</em> for generating SVG diagrams your
should specify the <code>-outputencoding UTF-8</code> option to UMLGraph. should specify the <code>-outputencoding UTF-8</code> option to UMLGraph.
This option will correctly render the stereotype guillemot characters This option will correctly render the stereotype guillemot characters