# Compiling VTK with OSPRay + Java wrappers enabled

**URL:** <https://discourse.vtk.org/t/compiling-vtk-with-ospray-java-wrappers-enabled/5461>\
**Category:** Development\
**Created:** [March 29, 2021, 3:49pm UTC](https://discourse.vtk.org/t/compiling-vtk-with-ospray-java-wrappers-enabled/5461 "2021-03-29T15:49:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thegbiv](https://discourse.vtk.org/user_avatar/discourse.vtk.org/thegbiv/32/2784_2.png) [@thegbiv](https://discourse.vtk.org/u/thegbiv)\
**Post date:** [March 29, 2021, 3:49pm UTC](https://discourse.vtk.org/t/compiling-vtk-with-ospray-java-wrappers-enabled/5461/1 "2021-03-29T15:49:40Z")

</div>

Hello,  
After a long hiatus, I’ve recently started picking up VTK, and WOW, so much progress and new features to play around with. Kudos to all involved!  
On to the question…  
I have been evaluating language support of various features of VTK and ran into some issues with raytracing support via OSPRay.

- I was able to build and run the examples in C++.

- I then transitioned to prototyping in python and that worked pretty flawlessly.

- Next, trying jvm support and I ran into an issue compiling VTK with OSPRay with java wrappings enabled.  
I’m compling with jdk 8 but the source target still seems to be 1.7. There are a few warnings during the build about that but the main error is with linking the `vtkOSPRayMaterialLibaryJava`…I get the following error:

Has anyone been able to successfully compile VTK with OSPRay + Java wrappers enabled?

- OS: Mac 11.2.3 (BigSur)
- VTK: 9, using master of git

```auto
commit 42d63c20859215e5a455d91f0f7c9a816d69805e (HEAD -> master, origin/master, origin/HEAD)
Merge: 64a1eddb20 122a7fed59
Author: Ben Boeckel <ben.boeckel@kitware.com>
Date: Thu Mar 11 13:42:57 2021 +0000

    Merge topic 'cmake-cleanups'

    122a7fed59 vtkSimpleImageFilterExample: deprecate example class
    a30797d087 cmake: quote variable expansions
    6b1e5bed8f cmake: prefer `foreach (IN LISTS)`
    b0eae3fc55 cmake: use PRIVATE_CLASSES where possible
    7fe5cc86a8 cmake: sort file and class listings

    Acked-by: Kitware Robot <kwrobot@kitware.com>
    Merge-request: !7734

```

Thanks for any advice here  
Gerrick

---

<div class="post-metadata">

**Author:** ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)\
**Post date:** [March 29, 2021, 6:17pm UTC](https://discourse.vtk.org/t/compiling-vtk-with-ospray-java-wrappers-enabled/5461/2 "2021-03-29T18:17:42Z")

</div>

The dependencies for the module might be mislabeled.

In the file `Rendering/RayTracing/vtk.module` can you try moving `VTK::CommonCore` from the `PRIVATE_DEPENDS` section to the `DEPENDS` section?

Since vtkOSPRayMaterialLibrary is a direct subclass of vtkObject, the CommonCore module is a direct dependency of RenderingRayTracing. The wrappers need these dependencies to be correct.

It looks like when vtkOSPRayMaterialLibrary was added to VTK, the module file should have been updated but wasn’t.

---

<div class="post-metadata">

**Author:** ![thegbiv](https://discourse.vtk.org/user_avatar/discourse.vtk.org/thegbiv/32/2784_2.png) [@thegbiv](https://discourse.vtk.org/u/thegbiv)\
**Post date:** [March 29, 2021, 7:27pm UTC](https://discourse.vtk.org/t/compiling-vtk-with-ospray-java-wrappers-enabled/5461/3 "2021-03-29T19:27:38Z")

</div>

Yup, that was exactly it! Should I file a ticket or what is the process you all are using to get that updated?

---

<div class="post-metadata">

**Author:** ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)\
**Post date:** [March 29, 2021, 7:46pm UTC](https://discourse.vtk.org/t/compiling-vtk-with-ospray-java-wrappers-enabled/5461/4 "2021-03-29T19:46:11Z")

</div>

If you’re willing, you can submit a merge request. The process is described [here.](https://github.com/Kitware/VTK/blob/master/CONTRIBUTING.md)

Briefly, you can make a topic branch with the fix:

```auto
checkout -b renderingraytracing-depends

```

and then submit the fix to gitlab:

```auto
git gitlab-push 

```

After doing this, a “Create Merge Request” button should appear at the top of the [VTK merge\_requests web page.](https://gitlab.kitware.com/vtk/vtk/-/merge_requests)

---

<div class="post-metadata">

**Author:** ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)\
**Post date:** [March 29, 2021, 10:18pm UTC](https://discourse.vtk.org/t/compiling-vtk-with-ospray-java-wrappers-enabled/5461/5 "2021-03-29T22:18:48Z")

</div>

Java 1.7 is the **minimum** requirement, so JDK1.8+ is fine.

---

<div class="post-metadata">

**Author:** ![thegbiv](https://discourse.vtk.org/user_avatar/discourse.vtk.org/thegbiv/32/2784_2.png) [@thegbiv](https://discourse.vtk.org/u/thegbiv)\
**Post date:** [March 30, 2021, 4:36am UTC](https://discourse.vtk.org/t/compiling-vtk-with-ospray-java-wrappers-enabled/5461/6 "2021-03-30T04:36:28Z")

</div>

Submitted: [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/7799#](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7799#)
