[vtkusers] VTK6 and Java Examples

Ric Wright rkwright at geofx.com
Mon Aug 5 08:02:16 EDT 2013


I recently pulled down VTK 6.0.0 and installed it.  Getting it running
provided to be a little more fun than I anticipated but I got there
(http://blogs.geofx.com/).

However, part of my confusion arose from what I believe is out of date
tutorials.  In the first Java tutorial, the first part pf the example has a
"load library" method:

> // In the static contructor we load in the native code.
> // The libraries must be in your path to work.
> static {
>    System.loadLibrary("vtkCommonJava");
>    System.loadLibrary("vtkFilteringJava");
>    System.loadLibrary("vtkIOJava");
>    System.loadLibrary("vtkImagingJava");
>    System.loadLibrary("vtkGraphicsJava");
>    System.loadLibrary("vtkRenderingJava");
> }

  This doesn't work with VTK 6.0.0.  Instead, one gets an exception

  java.lang.UnsatisfiedLinkError: no vtkCommonJava in java.library.path

  This turns out to be reasonable as there is no vtkCommonJava library in
the lib folder.

  In the example Cone2.java, the loading of libraries is significantly
different:

       // Load VTK library and print which library was not properly loaded
       static
       {
if (!vtkNativeLibrary.LoadAllNativeLibraries())
{
for (vtkNativeLibrary lib : vtkNativeLibrary.values())
{
if (!lib.IsLoaded())
{
System.out.println(lib.GetLibraryName() + " not loaded");
}
}
}
vtkNativeLibrary.DisableOutputWindow(null);
}

This works fine.  As it turns out, only the example Cone2.java uses the
"correct" method for loading the libraries.  Am I correct in assuming that
Cone 1 and Cone3-5 are simply out-of-date with respect to VTK 6.0.0?  Or am
I missing something?

I also note that only the simple "Sample" folder with its Cone examples even
has Java implementations.  I guess I am on my own to convert the examples to
Java myself (which is fine, that will be a good learning exercise) or will
that be a Quixotic effort on my part, tilting at an incomplete Java
windmill?

TIA,
Ric



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130805/37059317/attachment.htm>


More information about the vtkusers mailing list