Add installation instructions and clarify invocation.

This commit is contained in:
Diomidis Spinellis 2007-09-28 12:44:56 +00:00
parent 3000c1920a
commit 4777ec26fd
4 changed files with 103 additions and 33 deletions

View File

@ -1,13 +1,6 @@
<?xml version="1.0" ?>
<!-- $Id$ -->
<notes>
To use UMLGraph class drawing facility you need to have
<a href="http://java.sun.com/j2se/javadoc/"><em>javadoc</em></a>
and
<a href="http://www.graphviz.org/">Graphviz</a>
installed on your computer.
Both programs are freely available, from Sun and AT&amp;T respectively,
for many platforms including Unix and Windows.
UMLGraph's input follows the Java syntax and semantics.
However,
since the main purpose of UMLGraph is the declarative specification of
@ -23,21 +16,55 @@ Java code.
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
doclet API that specifies the content and format of the output
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>
There are various ways to invoke UmlGraph,
each providing a different balance between convenience and flexibility.
<h2>Option 1: Using the Supplied Scipt</h2>
This is the simplest option.
If <code>umlgraph</code> (or <code>umlgraph.bat</code>) is correctly
installed,
you can run UmlGraph by simply specifying the basename of
the Java file containing the diagram specification and the file type of
the generated diagram (e.g. gif, ps, png, svg).
Example:
<fmtcode ext="sh">
umlgraph Test png
</fmtcode>
Any additional UmlGraph or <em>javadoc</em> arguments can be added at
the end of the command line.
This command will read the specification file (e.g. Test.java) and
generate directly a diagram of the appropriate type
(e.g. Test.png).
<h2>Option 2: Running Java</h2>
This option provides the maximum flexibility.
In order to run, <em>javadoc</em> needs to access <code>tools.jar</code>.
You can accomplish this in two ways.
<ol>
<li>
Specify the location of <code>tools.jar</code> as a part of Java's classpath
and specify the full name of the UmlGraph doclet as an argument to Java.
This is an invocation example under Windows
<fmtcode ext="bat">
java -classpath "lib/UmlGraph.jar;c:\program files\java\jdk1.6.0_02\lib\Tools.jar"
gr.spinellis.umlgraph.doclet.UmlGraph -package Test.java
</fmtcode>
and under Unix
<fmtcode ext="sh">
java -classpath '/usr/share/lib/UmlGraph.jar:/opt/Java-1.6/lib/tools.jar' \
gr.spinellis.umlgraph.doclet.UmlGraph -package Test.java
</fmtcode>
</li>
<li> Place the <code>UmlGraph.jar</code>
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
You can accomplish this either by copying <code>UmlGraph.jar</code> 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.
where you installed UmlGraph.
You then run
<fmtcode ext="sh">
java -jar /path/to/UmlGraph.jar yourfile1.java ...
</fmtcode>
</li>
</ol>
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.
@ -53,10 +80,27 @@ 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 />
<h2>Option 3: Running Javadoc</h2>
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>
<h2>Running Dot</h2>
The last two options, will generate the UML diagram in
<em>Graphviz</em> <em>dot</em> format.
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>javadoc</em> will create by default a file named <code>graph.dot</code>
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">
@ -73,22 +117,6 @@ 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.

View File

@ -2,6 +2,7 @@
<!-- $Id$ -->
<index>
<ch><ti>Introduction</ti><fi>intro</fi></ch>
<ch><ti>Installation</ti><fi>install</fi></ch>
<ch><ti>Class Diagrams</ti><fi>cd-intro</fi></ch>
<ch><ti>Class Diagram Operations</ti><fi>cd-oper</fi></ch>
<ch><ti>Class Modelling</ti><fi>cd-model</fi></ch>

38
doc/install.xml Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="ISO-8859-7" ?>
<!-- $Id$ -->
<notes>
To install UmlGraph follow these steps.
<ol>
<li> Copy the files in <code>lib</code> to a directory you will
use for storing UmlGraph's installation
(for instance, <code>/usr/local/lib</code>).
</li>
<li> Copy the file <code>bin/umlgraph</code> (for Unix) or
<code>bin/umlgraph.bat</code> (for Windows) to a directory
of your execution path (for instance, <code>/usr/local/bin</code>).</li>
<li> Adjust the above file, setting <code>UMLGRAPH_HOME</code> to
point to the directory where you installed the UmlGraph library files.
</li>
</ol>
<p>
UMLGraph is implemented as a <em>javadoc</em> doclet (a program satisfying the
doclet API that specifies the content and format of the output
generated by the <em>javadoc</em> tool).
Furthermore, the output of UmlGraph needs to be post-processed
with the <em>Graphviz</em> <em>dot</em> program.
Therefore, to draw class diagrams with UmlGraph class you will need to have
<a href="http://java.sun.com/j2se/javadoc/"><em>javadoc</em></a>
and
<a href="http://www.graphviz.org/">Graphviz</a>
installed on your computer.
Both programs are freely available, from Sun and AT&amp;T respectively,
for many platforms including Unix and Windows.
<em>Javadoc</em> is part of the Sun JDK, so a typical JDK installation will also
include <em>javadoc</em>.
</p>
<p>
To draw UML sequence diagrams you must also install the free
<a href="http://www.gnu.org/software/plotutils/plotutils.html">GNU plotutils</a>
system.
</p>
</notes>

View File

@ -5,6 +5,9 @@
<dt>Version 4.9 Under development </dt><dd>
<ul>
<li> Added installation instructions. </li>
<li> Improved documentation for invoking UmlGraph. </li>
<li> Command-line scripts for invoking UmlGraph from Windows and Unix. </li>
<li> Test data is now compatible with the output of the Java 6.0 javadoc</li>
<li> Java 6.0 deprecated methods are marked in the code as such.</li>
<li> The -noguillemot option now outputs escaped characters compatible