# Paraview Java

**URL:** https://discourse.paraview.org/t/paraview-java/12160
**Category:** Development
**Created:** [May 26, 2023, 11:02am UTC](https://discourse.paraview.org/t/paraview-java/12160 "2023-05-26T11:02:05Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Julien](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/71e660/32.png) [@Julien](https://discourse.paraview.org/u/Julien)
#### Post date: [May 26, 2023, 11:02am UTC](https://discourse.paraview.org/t/paraview-java/12160/1 "2023-05-26T11:02:05Z")

</div>

Hello Everyone,  
I am considering using Paraview as a data viewer in a Java project, so in a Java dedicated window (probably a Java Swing JFrame/etc) and I was wondering whether it was possible and if there were a dedicated tutorial about that (at least for a hello world).

I have configured my Paraview build with the VTK Java option, and it indeed created a few \*.java files in the …\pv\pv\VTK\Wrapping\Java folder.  
But it’s a bit unclear to me whether it’s only a VTK option or a Paraview one too.  
When I configured the build the CMake it looked like it made something about both VTK and Paraview, so it looks promising, but I don’t know for sure.  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/d/d14c3b18e1be7754337a8576911af27b9507db5a.png)

So my questions are:

- is there a java Paraview wrapper or is it just the VTK layer?
- In python there is the paraview.simple module, and so is there an equivalent in Java by any chance?

Also, I would have thought there might be a \*.jar generated but I couldn’t find any (only .java)  
=\> Is there an official java Paraview Hello World of some sort available?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 26, 2023, 11:14am UTC](https://discourse.paraview.org/t/paraview-java/12160/2 "2023-05-26T11:14:58Z")

</div>

Hi @Julien

I’m afraid Java wrapping of VTK is not usable at ParaView level. I see two ways forward.

1. pvpython

Use ParaView python bindings as ParaViewWeb does in order to use ParaView in your application. You probably can call on python from Java.

[https://kitware.github.io/paraview-docs/latest/python/](https://kitware.github.io/paraview-docs/latest/python/)

1. Use libf3d java wrapping. F3D is a VTK based 3D viewer that may be what you are looking for if you just want to visualize data. No processing of data possible.

> **[Home](https://f3d.app)**
>
> F3D - Fast and minimalist 3D viewer

> <https://github.com/f3d-app/f3d/blob/master/java/testing/TestJavaBindings.java>

hth

---

<div class="post-metadata">

### Author: ![Julien](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/71e660/32.png) [@Julien](https://discourse.paraview.org/u/Julien)
#### Post date: [May 26, 2023, 12:35pm UTC](https://discourse.paraview.org/t/paraview-java/12160/3 "2023-05-26T12:35:34Z")

</div>

Well, thank you very much already! I am going to take a look at the two options your are referring to.

I had already guessed I could probably use a python wrapping layer in between but I would have to have a look at the details and see if it would not be too hard to maintain (and possibly a performance trade off, but probably nothing noticeable as it would be just a high level binding anyway)

On the other hand I guess Paraview has an API directly in C++, hasn’t it? (with similar functionalities as the python version, which is probably just calling the C++ API underneath?)  
That would mean I could do a (limited) Java binding with JNI (or maybe even JNA over the standards DLL, I don’t know)

Do you confirm it would be easy enough and realistic to build and maintain such JNI binding? (I have already made a JAWT binding of a basic in house 3D engine and it works well in our Java Swing application)  
Is there a known C++ good/simple example of an instanciation of a Paraview 3d window you would be aware of? I am going to have a look at that as well.

Thanks! 🙂

PS: our program will need a 3D viewer with some features as slice planes, animations and so on.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 26, 2023, 12:40pm UTC](https://discourse.paraview.org/t/paraview-java/12160/4 "2023-05-26T12:40:36Z")

</div>

> [@Julien](#):
>
> That would mean I could do a (limited) Java binding with JNI (or maybe even JNA over the standards DLL, I don’t know)

Yes

> Do you confirm it would be easy enough and realistic to build and maintain such JNI binding?

This will be a very hard work and unless it is automated and part of ParaView, a nightmare to maintain.

> Is there a known C++ good/simple example of an instanciation of a Paraview 3d window you would be aware of?

I’m afraid not.

---

<div class="post-metadata">

### Author: ![Julien](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/71e660/32.png) [@Julien](https://discourse.paraview.org/u/Julien)
#### Post date: [May 26, 2023, 12:46pm UTC](https://discourse.paraview.org/t/paraview-java/12160/5 "2023-05-26T12:46:29Z")

</div>

> [@mwestphal](#):
>
> Yes

Oh, neat, now this looks promising! …

> [@mwestphal](#):
>
> This will be a very hard work and unless it is automated and part of ParaView, a nightmare to maintain.

… shucks! 😢

> [@mwestphal](#):
>
> I’m afraid not.

All right!

So, probably python binding 😃  
Still, I am wondering what the python binding implementation looks like, as I imagine it could be used as a model to generate a java version look alike … I will have a quick look too, just in case.

Thank you very much!
