VTK 9.1 available as Maven dependency

Hi,

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

<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

<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

VtkNativeLibraries.initialize();

This is based on the recent improvements of JOGL allowing to run VTK Java Wrappers on macOS.

There is still room for improvement as partially discussed in the issue list. The project allowing to build such jars is here. Helpers on how to build for Java can be found here, with links to existing builds.

@toddy @Marco @Sebastien_Jourdain @LucasGandel

6 Likes

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

1 Like

Issue filed: https://gitlab.kitware.com/vtk/vtk/-/issues/18671

@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?

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 :slight_smile:

@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!

You may be interested by this report as well if you are working in Java : Fixed VTK Java Wrappers on macOS

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

@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!

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.

And sorry, if your question is where to download it you can read this.

OK great thanks!!