Kothar Labs Contact Me


Mon, 21 Jul 2008 / projects / jgraphviz / java

This project is hosted at SourceForge.


Graphviz is a widely used graph layout package developed by AT&T.

There exist several ways of using Graphviz from Java, but in most cases the Graphviz command line tools are called to parse files containing a graph definition and render a rasterised image of the graph.

This is unsatisfactory for many interactive applications, and a more direct interface to the layout algorithms is desirable. Java bindings generated using SWIG already exist as part of the Graphviz source code, however they are very low-level.

jGraphViz aims to build on these low-level bindings to provide a more flexible interface to the graph model and layout system. It also provides some basic support for rendering the resulting layouts using GEF, and packages the library as an OSGi plugin compatible with Eclipse and other OSGi containers.


  • Object-oriented interface to the Graphviz model
  • Graphviz layout algorithms: dot, circo, etc.
  • GEF/draw2D classes to support rendering of generated graphs

jGraphViz is currently experimental, and is only tested on GNU/Linux (Ubuntu 8.04). Graphviz must already be installed on the system; in future we aim to remove the external dependency on libgv, and package everything directly in the plugin.


To build the native component of jgraphviz, you must run the provided configure and make scripts. The standard libgv_java.so is not compatible due to a problem with the package of the automatically generated bindings.

First make sure you have configured the GraphViz source with java support enabled. You may need to use the following on Linux to enable the Java JNI headers to be located:

export CPPFLAGS="-I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux"
./configure --enable-java=yes

You should see a line containing “gv_java: Yes” if the configuration was successful. You should then run make in the GraphViz source directory to build the shared library.

You should now be ready to build the jGraphViz native library. First run the configure script, and then make.

chmod +x configure.sh
./configure.sh [--graphvizdir=../../graphviz]


jGraphViz is licenced under the Common Public Licence version 1.0.