Eclipse/Java - VTK native libraries can't be found with release mode

After integrating my vtk.jar and setting the library path in eclipse for use with the Java wrappers, the examples run fine in debug mode. But, in release mode, it can’t load the vtk native libraries; vtkNativeLibrary.LoadAllNativeLibraries() returns a null.

Can anyone help me resolve this? Thanks so much :slight_smile:

@Gilthalas @Marco

Hey Sebastian, you posted an empty reply. I was hoping someone else experienced this. Thanks.

Hello Doug,

first of all, which OS are you testing on, and which VTK version are you using?

In VTK 9.0, vtkNativeLibrary.LoadAllNativeLibraries() returns a “boolean”, hence it cannot return a “null”.

Also, please check whether UnsatisfiedLinkError exceptions are thrown. If yes, please provide the exact stack trace, which will tell us a lot.

I don’t have much experience with Eclipse, but I would ensure that the “-Djava.library.path” system property is passed to the “java” command even when you run your project in “Release” mode.

Are you using a block of code like this?

if (!vtkNativeLibrary.LoadAllNativeLibraries())
    {
      for (vtkNativeLibrary lib : vtkNativeLibrary.values())
      {
        if (!lib.IsLoaded())
        {
          System.out.println(lib.GetLibraryName() + " not loaded");
        }
      }
    }

What’s the output?

Regards,

Marco

Thanks Marco for your response. OK, that’s true, it dose return a boolean which is false. It’s inside on the LoadAllNativeLibraries() function that a null is returned and then the boolean is returned to the parent caller. I use the setProperty("vtk.lib.dir: ", vtkLibPath). This works fine in debug mode. But I will see if that path is different for release mode. Thanks.

Hey Marco, yes I am using code like that and it works in debug mode but not in release mode. The output is UnsatisfiedLinkError exceptions.

Hello,

if you can provide the exact and complete stack trace of your exceptions, then maybe we can help further.

Regards,

Marco