The jCAE project has started a migration process from Java3D to VTK. The main reason why we are giving up java3d is the lack of picking features. The viewer3d module will be replaced by a vtk-util module.

Building VTK

Getting source

Kitware doesn't provide binary distributions with Java binding enabled so you have to build VTK by yourself. The current version of vtk-util requires at least VTK 5.2, and is also known to work with VTK 5.3 (current CVS HEAD). The latter is an unreleased CVS version. See http://www.vtk.org.


Here are the requirements to build VTK with Java binding:

  • patch. You have it in your Linux distro. There are also Windows binaries.
  • cmake
  • GNU make and gcc [Linux], or Visual Studio Express [Windows], or any other set of compilation tool supported by cmake.
  • OpenGL header and developer libraries
  • The Sun Java Development Kit

On Debian/Ubuntu system just do:

apt-get install patch make cmake libgl1-mesa-dev sun-java6-jdk


By developing jCAE we fixed several problems in VTK and sent our patches to VTK Bug Tracker. They are not yet integrated in the VTK CVS repository. You may find them here: https://jcae.svn.sourceforge.net/svnroot/jcae/trunk/vtk-util/patch. The patching commands will look like this:

cd /a/foo/path/VTK
patch -p1 < /tmp/depth
patch -p1 < /tmp/displayList
patch -p1 < /tmp/offset
patch -p1 < /tmp/translucent
patch -p1 < /tmp/underscore
patch -p1 < /tmp/warning
patch -p1 < /tmp/light

We are maintaining our patches with the help of quilt; the list of patches above may become outdated, but if you have quilt installed on your machine, you can run the apply.sh shell script under vtk-util/patch/nightly/ or vtk-util/patch/5.2/ like this:

cd /a/foo/path/VTK
sh /path/to/vtk-util/patch/nightly/apply.sh

This script calls quilt to apply patches listed in the series file. We maintain our own VTK tree this way, so this method should always work.

Configuring and building

mkdir /a/bar/path/build-vtk
cd /a/bar/path/build-vtk
cmake /a/foo/path/VTK

This will create a default configuration file name CMakeCache.txt. To build the Java binding you have to modify it. Here is an example for Debian like distribution:

//Path to a program.

//Path to a file.

//Path to a library.

//Path to a program.

//Path to a file.

//Path to a file.

//Path to a program.

To speed up compilation, you can disable Python and Tcl wrappers, and always use system libraries (if headers and libraries are installed, of course) by setting all VTK_USE_SYSTEM_* variables to ON. Then rerun cmake ../VTK to take the change into account. Finally run make.

The building process on Windows is similar except that the CMakeCache.txt edition can be done through a GUI and that you will probably use Visual Studio instead of GNU Make/GCC.

Other documentation

For more documentation see the VTK wiki.