N.B. You are advised to use TCL for the practicals but .....
A simple VTK java example is available from:
/usr/share/doc/vtk-examples-4.2.4/Examples/Tutorial/Step1/Java/Cone.java
Copy this to your own directory.
To compile a VTK java example under DICE, Cone.java, you must specify the vtk jar archive in the class path at compilation as follows:
javac -classpath /usr/lib/vtk/java/vtk.jar Cone.java
which results in a file Cone.class in the current directory.
As the VTK java interface relies on calls to native code via the JNI you must additionally set the linker library path in the shell as follows (N.B. paths may vary for non-DICE systems):
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/vtk/:/usr/lib/jvm/java-1.5.0-su
n-1.5.0.04/jre/lib/i386/xawt/
(you can add this line to your .brc file (DICE) or your .bashrc file (non-DICE s ystems) to have this set automatically)
Finally, run the compiled example with the class path specified for the VTK jar archive and the current directory (i.e. with ":." added) that contains the Cone.class file created from earlier compilation:
java -classpath /usr/lib/vtk/java/vtk.jar:. Cone
If you have specfic problems with getting java code to run, try first with the simple cone example. If your problems persist then email me. Please also email me any ammendmants you have to make for other systems so that they can be posted to others.
Further java examples are available both online (see links on main page for lecture 2) and in the following directory structure:
/usr/share/doc/vtk-examples-4.2.4/Examples/
N.B. You are advised to use TCL for the practicals.
Taku Komura
[Visualisation Course Page]
Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail: school-office@inf.ed.ac.uk Please contact our webadmin with any comments or corrections. Logging and Cookies Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh |