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

**URL:** https://discourse.vtk.org/t/eclipse-java-vtk-native-libraries-cant-be-found-with-release-mode/3476
**Category:** Development
**Created:** [June 5, 2020, 5:57pm UTC](https://discourse.vtk.org/t/eclipse-java-vtk-native-libraries-cant-be-found-with-release-mode/3476 "2020-06-05T17:57:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dporter](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dporter](https://discourse.vtk.org/u/dporter)
#### Post date: [June 5, 2020, 5:57pm UTC](https://discourse.vtk.org/t/eclipse-java-vtk-native-libraries-cant-be-found-with-release-mode/3476/1 "2020-06-05T17:57:24Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [June 8, 2020, 2:29pm UTC](https://discourse.vtk.org/t/eclipse-java-vtk-native-libraries-cant-be-found-with-release-mode/3476/2 "2020-06-08T14:29:55Z")

</div>

@Gilthalas @Marco

---

<div class="post-metadata">

### Author: ![dporter](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dporter](https://discourse.vtk.org/u/dporter)
#### Post date: [June 8, 2020, 2:57pm UTC](https://discourse.vtk.org/t/eclipse-java-vtk-native-libraries-cant-be-found-with-release-mode/3476/3 "2020-06-08T14:57:51Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Marco](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marco/32/1461_2.png) [@Marco](https://discourse.vtk.org/u/Marco)
#### Post date: [June 8, 2020, 3:36pm UTC](https://discourse.vtk.org/t/eclipse-java-vtk-native-libraries-cant-be-found-with-release-mode/3476/4 "2020-06-08T15:36:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dporter](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dporter](https://discourse.vtk.org/u/dporter)
#### Post date: [June 8, 2020, 3:48pm UTC](https://discourse.vtk.org/t/eclipse-java-vtk-native-libraries-cant-be-found-with-release-mode/3476/5 "2020-06-08T15:48:50Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dporter](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dporter](https://discourse.vtk.org/u/dporter)
#### Post date: [June 11, 2020, 3:31pm UTC](https://discourse.vtk.org/t/eclipse-java-vtk-native-libraries-cant-be-found-with-release-mode/3476/6 "2020-06-11T15:31:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Marco](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marco/32/1461_2.png) [@Marco](https://discourse.vtk.org/u/Marco)
#### Post date: [June 12, 2020, 10:25am UTC](https://discourse.vtk.org/t/eclipse-java-vtk-native-libraries-cant-be-found-with-release-mode/3476/7 "2020-06-12T10:25:53Z")

</div>

Hello,

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

Regards,

Marco
