VTK 9 + Java on Mac


I am trying to build VTK 9.0 with Java bindings on macOS 10.15.4 (latest).

I am aware that there is a similar discussion on the “Development” forum (Problem with java bindings in VTK 9), but as of now my issue is somehow more “basic” than what treated in that discussion, so I preferred to open a different topic under the “Support” forum.

As I read in the other forum that some issues have been fixed after the VTK 9.0.0 release, I’ve pulled VTK from the current GIT master branch. So, I am working on the current (i.e., today’s) GIT master version.

I managed to download JOGL, I activated the VTK_WRAP_JAVA and the VTK_JAVA_JOGL_COMPONENT options on CMake, and I set the JOGL_GLUE and JOGL_LIB variable to correct values.

I set “XCode” as the code generator in CMake. First question: is this the correct/best thing to do in order to build VTK 9 under macOS, or not?

In any case, CMake’s configure completes correctly (apparently) and I can open my XCode project.

I tried to build the “ALL_BUILD” target, and the build process completes successfully after some minutes.

After the build, looking at the “lib” subfolder of my build output folder, I can see all the “libvtk*.dylib” libraries I expect to see, and also all the “libvtk*Java.jnilib” libraries I expect to see.

However, it looks like the Java sources (which are indeed generated under /Wrapping/Java/vtk) are then NOT being compiled, and vtk.jar is NOT generated, as far as I can see.

Is this expected? Shouldn’t vtk.jar be built as part of the BUILD_ALL target, considering my CMake selections?

Any suggestion will be greatly appreciated.

Thanks in advance and best regards,

Marco Sambin

I don’t think it matters but the generator that I tend to use is -G Ninja.

Thanks for your feedback Seb.

I will also try to build the same VTK version under Windows, in order to check whether the .java files are compiled into .class files there, and the vtk.jar archive is finally produced under that platform.

Can you give me a pointer to where in the makefiles the process of compiling .java files into .class files is specified, with the final generation of the vtk.jar archive?

I would like to take a look, and try to understand where the caveat resides.

Thanks in advance for your feedback.
Best regards,

Marco Sambin

See Wrapping/Java/CMakeLists.txt:186 (add_library(vtkjava STATIC)

The Xcode generator is not well-tested for VTK. I think only the iOS build (which doesn’t support/use Java) actively tests it. I recommend using the Ninja generator here.

Hello Ben,

thank you for your message, I will follow your suggestion.

However, I’ve just tried building VTK 9.0.0 (official release) under Windows with Microsoft Visual Studio 2017 (the same code generator I successfully used with VTK 8.2.0), and I obtain the same result: vtk*.dll and vtk*Java.dll successfully generated, *.java files successfully generated, but .java files are NOT compiled into .class files, and vtk.jar is NOT generated.

Either I am missing some basic option, or there is an issue with VTK 9.0.0 with building the Java files (even though it seems strange to me that no other users has encountered this yet).

I would appreciate suggestions about what I should check.

Thanks and best regards,

Marco Sambin

What if you run the vtkjava target manually?

Hello Ben,

thanks for your reply.

If I do this:


the here is what I see in my “Build output” window:


1>------ Build started: Project: vtkCommonCore-hierarchy, Configuration: Debug x64 ------
2>------ Build started: Project: vtkCommonMath-hierarchy, Configuration: Debug x64 ------
3>------ Build started: Project: vtkRenderingSceneGraph-hierarchy, Configuration: Debug x64 ------
4>------ Build started: Project: vtkCommonSystem-hierarchy, Configuration: Debug x64 ------
5>------ Build started: Project: vtkParallelCore-hierarchy, Configuration: Debug x64 ------
6>------ Build started: Project: vtkCommonTransforms-hierarchy, Configuration: Debug x64 ------
7>------ Build started: Project: vtkCommonMisc-hierarchy, Configuration: Debug x64 ------
8>------ Build started: Project: vtkRenderingVtkJS-hierarchy, Configuration: Debug x64 ------
9>------ Build started: Project: vtkCommonDataModel-hierarchy, Configuration: Debug x64 ------
10>------ Build started: Project: vtkCommonExecutionModel-hierarchy, Configuration: Debug x64 ------
11>------ Build started: Project: vtkIOXMLParser-hierarchy, Configuration: Debug x64 ------
12>------ Build started: Project: vtkCommonColor-hierarchy, Configuration: Debug x64 ------
13>------ Build started: Project: vtkCommonComputationalGeometry-hierarchy, Configuration: Debug x64 ------
14>------ Build started: Project: vtkFiltersCore-hierarchy, Configuration: Debug x64 ------
15>------ Build started: Project: vtkFiltersGeometry-hierarchy, Configuration: Debug x64 ------
16>------ Build started: Project: vtkImagingCore-hierarchy, Configuration: Debug x64 ------
17>------ Build started: Project: vtkFiltersSources-hierarchy, Configuration: Debug x64 ------
18>------ Build started: Project: vtkIOCore-hierarchy, Configuration: Debug x64 ------
19>------ Build started: Project: vtkFiltersStatistics-hierarchy, Configuration: Debug x64 ------
20>------ Build started: Project: vtkFiltersTexture-hierarchy, Configuration: Debug x64 ------
21>------ Build started: Project: vtkIOXML-hierarchy, Configuration: Debug x64 ------
22>------ Build started: Project: vtkImagingSources-hierarchy, Configuration: Debug x64 ------
23>------ Build started: Project: vtkImagingMath-hierarchy, Configuration: Debug x64 ------
24>------ Build started: Project: vtkFiltersImaging-hierarchy, Configuration: Debug x64 ------
25>------ Build started: Project: vtkIOImage-hierarchy, Configuration: Debug x64 ------
26>------ Build started: Project: vtkRenderingCore-hierarchy, Configuration: Debug x64 ------
27>------ Build started: Project: vtkFiltersGeneral-hierarchy, Configuration: Debug x64 ------
28>------ Build started: Project: vtkIOLegacy-hierarchy, Configuration: Debug x64 ------
29>------ Build started: Project: vtkImagingGeneral-hierarchy, Configuration: Debug x64 ------
30>------ Build started: Project: vtkFiltersHybrid-hierarchy, Configuration: Debug x64 ------
31>------ Build started: Project: vtkIOMovie-hierarchy, Configuration: Debug x64 ------
32>------ Build started: Project: vtkIOLSDyna-hierarchy, Configuration: Debug x64 ------
33>------ Build started: Project: vtkFiltersGeneric-hierarchy, Configuration: Debug x64 ------
34>------ Build started: Project: vtkRenderingUI-hierarchy, Configuration: Debug x64 ------
35>------ Build started: Project: vtkFiltersExtraction-hierarchy, Configuration: Debug x64 ------
36>------ Build started: Project: vtkFiltersModeling-hierarchy, Configuration: Debug x64 ------
37>------ Build started: Project: vtkInteractionWidgets-hierarchy, Configuration: Debug x64 ------
38>------ Build started: Project: vtkRenderingContext2D-hierarchy, Configuration: Debug x64 ------
39>------ Build started: Project: vtkRenderingFreeType-hierarchy, Configuration: Debug x64 ------
40>------ Build started: Project: vtkInteractionStyle-hierarchy, Configuration: Debug x64 ------
41>------ Build started: Project: vtkRenderingVolume-hierarchy, Configuration: Debug x64 ------
42>------ Build started: Project: vtkRenderingOpenGL2-hierarchy, Configuration: Debug x64 ------
43>------ Build started: Project: vtkIOImport-hierarchy, Configuration: Debug x64 ------
44>------ Build started: Project: vtkIOMINC-hierarchy, Configuration: Debug x64 ------
45>------ Build started: Project: vtkFiltersParallel-hierarchy, Configuration: Debug x64 ------
46>------ Build started: Project: vtkIOMotionFX-hierarchy, Configuration: Debug x64 ------
47>------ Build started: Project: vtkFiltersAMR-hierarchy, Configuration: Debug x64 ------
48>------ Build started: Project: vtkInfovisCore-hierarchy, Configuration: Debug x64 ------
49>------ Build started: Project: vtkIOGeometry-hierarchy, Configuration: Debug x64 ------
50>------ Build started: Project: vtkIOExport-hierarchy, Configuration: Debug x64 ------
51>------ Build started: Project: vtkIOInfovis-hierarchy, Configuration: Debug x64 ------
52>------ Build started: Project: vtkIONetCDF-hierarchy, Configuration: Debug x64 ------
53>------ Build started: Project: vtkViewsCore-hierarchy, Configuration: Debug x64 ------
54>------ Build started: Project: vtkIOOggTheora-hierarchy, Configuration: Debug x64 ------
55>------ Build started: Project: vtkIOPLY-hierarchy, Configuration: Debug x64 ------
56>------ Build started: Project: vtkRenderingGL2PSOpenGL2-hierarchy, Configuration: Debug x64 ------
57>------ Build started: Project: vtkIOParallelXML-hierarchy, Configuration: Debug x64 ------
58>------ Build started: Project: vtkIOParallel-hierarchy, Configuration: Debug x64 ------
59>------ Build started: Project: vtkIOSQL-hierarchy, Configuration: Debug x64 ------
60>------ Build started: Project: vtkIOSegY-hierarchy, Configuration: Debug x64 ------
61>------ Build started: Project: vtkIOTecplotTable-hierarchy, Configuration: Debug x64 ------
62>------ Build started: Project: vtkIOVeraOut-hierarchy, Configuration: Debug x64 ------
63>------ Build started: Project: vtkIOExportPDF-hierarchy, Configuration: Debug x64 ------
64>------ Build started: Project: vtkIOVideo-hierarchy, Configuration: Debug x64 ------
65>------ Build started: Project: vtkFiltersParallelImaging-hierarchy, Configuration: Debug x64 ------
66>------ Build started: Project: vtkFiltersSMP-hierarchy, Configuration: Debug x64 ------
67>------ Build started: Project: vtkImagingColor-hierarchy, Configuration: Debug x64 ------
68>------ Build started: Project: vtkFiltersFlowPaths-hierarchy, Configuration: Debug x64 ------
69>------ Build started: Project: vtkImagingFourier-hierarchy, Configuration: Debug x64 ------
70>------ Build started: Project: vtkImagingHybrid-hierarchy, Configuration: Debug x64 ------
71>------ Build started: Project: vtkFiltersPoints-hierarchy, Configuration: Debug x64 ------
72>------ Build started: Project: vtkImagingMorphological-hierarchy, Configuration: Debug x64 ------
73>------ Build started: Project: vtkChartsCore-hierarchy, Configuration: Debug x64 ------
74>------ Build started: Project: vtkIOExportGL2PS-hierarchy, Configuration: Debug x64 ------
75>------ Build started: Project: vtkImagingStatistics-hierarchy, Configuration: Debug x64 ------
76>------ Build started: Project: vtkImagingStencil-hierarchy, Configuration: Debug x64 ------
77>------ Build started: Project: vtkFiltersProgrammable-hierarchy, Configuration: Debug x64 ------
78>------ Build started: Project: vtkInfovisLayout-hierarchy, Configuration: Debug x64 ------
79>------ Build started: Project: vtkInteractionImage-hierarchy, Configuration: Debug x64 ------
80>------ Build started: Project: vtkFiltersHyperTree-hierarchy, Configuration: Debug x64 ------
81>------ Build started: Project: vtkDomainsChemistry-hierarchy, Configuration: Debug x64 ------
82>------ Build started: Project: vtkRenderingAnnotation-hierarchy, Configuration: Debug x64 ------
83>------ Build started: Project: vtkFiltersSelection-hierarchy, Configuration: Debug x64 ------
84>------ Build started: Project: vtkFiltersTopology-hierarchy, Configuration: Debug x64 ------
85>------ Build started: Project: vtkFiltersVerdict-hierarchy, Configuration: Debug x64 ------
86>------ Build started: Project: vtkRenderingImage-hierarchy, Configuration: Debug x64 ------
87>------ Build started: Project: vtkRenderingLOD-hierarchy, Configuration: Debug x64 ------
88>------ Build started: Project: vtkRenderingLabel-hierarchy, Configuration: Debug x64 ------
89>------ Build started: Project: vtkGeovisCore-hierarchy, Configuration: Debug x64 ------
90>------ Build started: Project: vtkIOAMR-hierarchy, Configuration: Debug x64 ------
91>------ Build started: Project: vtkIOAsynchronous-hierarchy, Configuration: Debug x64 ------
92>------ Build started: Project: vtkIOCityGML-hierarchy, Configuration: Debug x64 ------
93>------ Build started: Project: vtkRenderingVolumeOpenGL2-hierarchy, Configuration: Debug x64 ------
94>------ Build started: Project: vtkIOEnSight-hierarchy, Configuration: Debug x64 ------
95>------ Build started: Project: vtkTestingRendering-hierarchy, Configuration: Debug x64 ------
96>------ Build started: Project: vtkViewsContext2D-hierarchy, Configuration: Debug x64 ------
97>------ Build started: Project: vtkIOExodus-hierarchy, Configuration: Debug x64 ------
98>------ Build started: Project: vtkViewsInfovis-hierarchy, Configuration: Debug x64 ------
========== Build: 98 succeeded, 0 failed, 5 up-to-date, 0 skipped ==========


Any suggestions or requests are welcome.
Best regards,


@brad.king Any idea why Java support in CMake would make an add_library just not work here?


strangely enough, I’ve just tried following your suggestion under macOS, and I’ve just tried building VTK 9 (GIT master) through Ninja, and vtk.jar is correctly generated there.

However, on Windows + VS 2017 something is not working.

So, in summary:

  • macOS: VTK 9 (GIT master) + XCode --> vtk.jar NOT generated and .class files not generated
  • macOS: VTK 9 (GIT master) + Ninja --> vtk.jar generated
  • Windows: VTK 9.0.0 (official release) + VS 2017 --> vtk.jar NOT generated and .class files not generated

I am available to do any test, if you want me to try something.

Thanks in advance and best regards,

Marco Sambin

Even on Windows you should use Ninja. It is so much faster.

Hello Seb,

that’s what I am trying, but I am encontering some issues with CMake… It looks like it is not automatically recognizing the build tools (while I had no problems under macOS):

Can you suggest how to fix this?
Thanks and best regards,

Marco Sambin

You need to run cmake-gui from a Developer Command Prompt for the toolchain you want to use.

Thanks Ben,

CMake now is “configuring” correctly.
I will let you know the outcome of the build process through Ninja.


Probably I spoke too soon…

Finalizing “Configure” seems much more complicated with Ninja.
It is requesting me to install a lot of exernal tools (CURL, OpenSSL, and maybe others in successive steps…) and to set many variables manually. I think I will need to finish this tomorrow.

In all cases, VTK 8.2.0 was building correctly and very easily through Visual Studio 2017 with Java bindings. VTK 9.0.0 apparently is not.

I will go on with my build attempt and will update you ASAP.



Well, I am getting a bit lost…
Is it expected that I get all these “-NOTFOUND” in CMake variable values, and that I need to set all this manually? Or maybe, there is some procedural error on my side with my usage of the Ninja generator under Windows?

On macOS, with the Ninja generator, everything has been much simpler.
Thanks in advance for any input.

Best regards,

Marco Sambin

I’d only worry about the -NOTFOUND variables if something actually complains about them. There might be logic that handles those libraries not being available.

Hello Ben,

OK, I “somehow” managed to get to the end of the configure process.
I’ve now launched “ninja” always from the Developer Command Prompt, in CMake’s output folder.
The build is in progress, but I am getting tons of this warning messages:

warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

Can I safely ignore this warning?
Also (may be related), during the build a debug window comes out saying:

< An unhandled win32 exception occurred in vtkWrapHierarchy-9.0d.exe [21772] >

and asking which debugger to use to debug this exception… doesn’t seem completely normal…

Any comment / suggestions are welcome.
Will update you about the outcome of the ninja build.



As an update to my previous post above, actually the build process seems to “freeze” at a certain point, probably as a consequence of that debug window that appears, as explained in my previous email message. It may be an issue specific to the “Debug” build of the library, I will now try if building in Release mode will make a difference.

However, to be honest, I would very much like to be able to use Visual Studio 2017 for building VTK under Windows, as I’ve always done.

Any suggestion / recommendation would be really welcome at this point.

Thanks and best regards,


Hmm. Possibly. @dgobbi Do you know of any crashes present in vtkWrapHierarchy?

No, I haven’t seen any recent crashing of vtkWrapHierarchy, and it gets a lot of coverage from both the VTK and the Paraview dashboards. I would need a stack trace, a verbose build log, or some way to reproduce the crash.