# VTK 9.1 available as Maven dependency

**URL:** https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371
**Category:** Announcements
**Created:** [September 16, 2022, 4:58pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371 "2022-09-16T16:58:31Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [September 16, 2022, 4:58pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/1 "2022-09-16T16:58:31Z")

</div>

Hi,

Marcel Luethi and I have packed all VTK libraries in Java jars that can now be added in Maven projects as follow.

```xml
<dependency>
    <groupId>org.jzy3d</groupId>
    <artifactId>vtk-java-all</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</dependency>

```

Which for now requires to add Jzy3D’s maven repository that provides it

```xml
<repositories>
  <repository>
    <id>jzy3d-snapshots</id>
    <name>Jzy3d Snapshots</name>
    <url>https://maven.jzy3d.org/snapshots/</url>
  </repository>
  <repository>
    <id>jzy3d-releases</id>
    <name>Jzy3d Releases</name>
    <url>https://maven.jzy3d.org/releases/</url>
  </repository>
</repositories>

```

This brings VTK 9.1 and JOGL 2.4 for Windows, Linux, macOS+Intel and macOS+M1. The nice thing is that the platform is detected automatically and there is no boring path definition to provide.

Unpacking and loading native libraries requires this line at the beginning of a program

```java
VtkNativeLibraries.initialize();

```

This is based on the recent [improvements of JOGL allowing to run VTK Java Wrappers on macOS](https://discourse.vtk.org/t/fixed-vtk-java-wrappers-on-macos).

There is still room for improvement as partially discussed in the [issue list](https://github.com/jzy3d/vtk-java-natives/issues). The project allowing to build such jars is [here](https://github.com/jzy3d/vtk-java-natives). Helpers on how to build for Java can be found [here](https://github.com/jzy3d/vtk-java-wrapper), with links to existing builds.

@toddy @Marco @Sebastien_Jourdain @LucasGandel

---

<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: [September 16, 2022, 7:07pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/2 "2022-09-16T19:07:28Z")

</div>

This is awesome, thanks for sharing… I hope one day we could automate that with our CI.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [September 20, 2022, 12:24am UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/3 "2022-09-20T00:24:33Z")

</div>

> [@Sebastien\_Jourdain](#):
>
> I hope one day we could automate that with our CI.

Issue filed: [https://gitlab.kitware.com/vtk/vtk/-/issues/18671](https://gitlab.kitware.com/vtk/vtk/-/issues/18671)

---

<div class="post-metadata">

### Author: ![Gilthalas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gilthalas/32/362_2.png) [@Gilthalas](https://discourse.vtk.org/u/Gilthalas)
#### Post date: [September 27, 2022, 8:53pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/4 "2022-09-27T20:53:39Z")

</div>

@Martin3d I cannot tell how THRILLED I am to see something like this.

Question: we have some patches on top of VTK that we have to expose some addition API to the wrappers - is it possible for me to run this process myself of building the Java jars so I can patch those files first? (I am just seeing this at the end of the day and haven’t had a chance to read through all your links). Regardless GREAT JOB - do you have plans to do the same for 9.2?

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [September 27, 2022, 9:26pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/5 "2022-09-27T21:26:25Z")

</div>

Hi Josh,

Thank you !

The readme explain well how to proceed step by step. To summarize you should simply extract all your native libs in src/main/resources folder of each target platform and then run the usual mvn install to get them all.

I should warn you that I noticed a platform selection issue with macOS M1 builds (you will find a ticket about it on the GitHub repo). Feel free to mention other issue on GitHub.

Following Sebastien’s comment, I think this should be integrated into Kitware CI to consistently build all upcoming version : the 9.1 build come from compilations I did separately on several OS and I would not like to this twice 🙂

---

<div class="post-metadata">

### Author: ![Gilthalas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gilthalas/32/362_2.png) [@Gilthalas](https://discourse.vtk.org/u/Gilthalas)
#### Post date: [September 27, 2022, 9:42pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/6 "2022-09-27T21:42:29Z")

</div>

@Martin3d yes I see that now - so still a manual build process (which we are doing anyway because of the patch) but your project jars everything up into the maven deliverable (Java+natives) which is a piece we have been missing! Very much looking forward to playing with this tomorrow!

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [September 27, 2022, 10:38pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/7 "2022-09-27T22:38:19Z")

</div>

You may be interested by this report as well if you are working in Java : [Fixed VTK Java Wrappers on macOS](https://discourse.vtk.org/t/fixed-vtk-java-wrappers-on-macos/7467)

---

<div class="post-metadata">

### Author: ![Gilthalas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gilthalas/32/362_2.png) [@Gilthalas](https://discourse.vtk.org/u/Gilthalas)
#### Post date: [September 28, 2022, 12:41pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/8 "2022-09-28T12:41:27Z")

</div>

Yeah that is great information to have - we had things running fairly well but I am always looking for ways to streamline things.

---

<div class="post-metadata">

### Author: ![Gilthalas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gilthalas/32/362_2.png) [@Gilthalas](https://discourse.vtk.org/u/Gilthalas)
#### Post date: [September 28, 2022, 2:22pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/9 "2022-09-28T14:22:49Z")

</div>

@Martin3d curious - where did you get the rc4 JOGL/GlueGen files? The latest I can find is some rc with a date in 2021. Thanks!

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [September 28, 2022, 2:27pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/10 "2022-09-28T14:27:15Z")

</div>

I built it myself. It is just a patch of the previous release where I appended the OpenGL java binding for macOS M1. The procedure I followed should be provided on the links I sent if you prefer to do it by yourself.

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [September 28, 2022, 2:29pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/11 "2022-09-28T14:29:27Z")

</div>

And sorry, if your question is where to download it you can read [this](https://github.com/jzy3d/jogl-maven-deployer#getting-jogl-24-rc-4-for-macos-bigsur-20211116).

---

<div class="post-metadata">

### Author: ![Gilthalas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gilthalas/32/362_2.png) [@Gilthalas](https://discourse.vtk.org/u/Gilthalas)
#### Post date: [September 28, 2022, 2:29pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/12 "2022-09-28T14:29:52Z")

</div>

OK great thanks!!

---

<div class="post-metadata">

### Author: ![Gilthalas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gilthalas/32/362_2.png) [@Gilthalas](https://discourse.vtk.org/u/Gilthalas)
#### Post date: [October 6, 2022, 9:46pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/13 "2022-10-06T21:46:16Z")

</div>

@Martin3d hey Martin one more question (I hope) - when loading the native libs when I run (under Eclipse if that matters), it is attempting to look for dependent libraries relative to @rpath, and not finding the necessary files. Have you run into this, and if so, is there a way to get around it? I fear I may have to rebuild VTK with a flag flipped or something.

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [October 11, 2022, 6:25am UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/14 "2022-10-11T06:25:54Z")

</div>

Sorry I missed this.  
The [platform handler](https://github.com/jzy3d/vtk-java-natives/blob/main/vtkJavaNatives/src/main/java/ch/unibas/cs/gravis/vtkjavanativelibs/VtkNativeLibrariesImpl.java#L22) defines the list of libraries that are loaded in order so maybe you provided libraries that depend on a library that is not this list?  
Once you identified it, you should mention it in all platform handlers

---

<div class="post-metadata">

### Author: ![Gilthalas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gilthalas/32/362_2.png) [@Gilthalas](https://discourse.vtk.org/u/Gilthalas)
#### Post date: [October 11, 2022, 11:28am UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/15 "2022-10-11T11:28:55Z")

</div>

Ah of course, an order dependency! I should have thought of that. I’ll give it a try!

---

<div class="post-metadata">

### Author: ![Martin3d](https://discourse.vtk.org/user_avatar/discourse.vtk.org/martin3d/32/4303_2.png) [@Martin3d](https://discourse.vtk.org/u/Martin3d)
#### Post date: [October 11, 2022, 4:03pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/16 "2022-10-11T16:03:00Z")

</div>

Marcel added [Python](https://github.com/jzy3d/vtk-java-natives/tree/main/tools) scripts that may be useful to get the dependencies in order. I did not use them so I am interested by your feedback on it if you are packaging other VTK versions than 9.1.

---

<div class="post-metadata">

### Author: ![Gilthalas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gilthalas/32/362_2.png) [@Gilthalas](https://discourse.vtk.org/u/Gilthalas)
#### Post date: [October 11, 2022, 4:14pm UTC](https://discourse.vtk.org/t/vtk-9-1-available-as-maven-dependency/9371/17 "2022-10-11T16:14:35Z")

</div>

That is great! I am building for 9.2, will let you know.
