[vtkusers] VTK6 and Java Examples

Sebastien Jourdain sebastien.jourdain at kitware.com
Mon Aug 5 08:43:27 EDT 2013


Hi Ric,

you are correct those wiki example seems to be out of date specially since
the modularization of VTK where all the libraries have been renamed and
shift around.

The best place to look for up-to-date examples is in the vtk.jar itself
which should contains a set of sample code with the proper usage of
rendering and GC classes as well as the loading of the libraries.

And Gerrick just beat me... ;-)

Good luck,

Seb


On Mon, Aug 5, 2013 at 8:02 AM, Ric Wright <rkwright at geofx.com> wrote:

> 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
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130805/47d82148/attachment.htm>


More information about the vtkusers mailing list