[vtk-developers] Java wrapping

Sebastien Jourdain sebastien.jourdain at kitware.com
Tue Apr 11 09:15:24 EDT 2017


The issue (I believe) is that you are not using the EDT to do your
interaction with VTK.

Specially for the part below:

    //
    // now we loop over 360 degreeees and render the cone each time
    //
    int i;
    for (i = 0; i < 360; ++i)
      {
      // render the image
      renWin.Render();
      // rotate the active camera by one degree
      ren1.GetActiveCamera().Azimuth( 1 );
      }
    }

Moreover, on Mac, you can not really use the standard render window with
Java. You should build VTK with JOGL and use the JOGL rendering component
like in the example here:
https://github.com/Kitware/VTK/blob/master/Wrapping/Java/vtk/sample/rendering/JoglConeRendering.java

For JOGL, you may want to read that first:
https://github.com/Kitware/VTK/blob/master/Wrapping/Java/README.txt


On Tue, Apr 11, 2017 at 4:25 AM, Csaba Vörös <voroscsaba.kanizsa at gmail.com>
wrote:

> Hi Sebastian!
>
> I tried Load AllNativeLibraries() function and I got some exception that
> not found the .dylib libraries. I rewrote the libraries path to my build
> folder and it seems to me the code is correctly run. But the problem is I
> don't see anything because the window is close very fast. I uploaded the
> source code to Google Drive that you can see.
>
> https://drive.google.com/file/d/0BxKX9JI3_72IdHlpWkNZbHhqcW8/view?usp=
> sharing
>
> Thank you
>
> Csaba
>
> 2017-04-09 2:01 GMT+02:00 Sebastien Jourdain <sebastien.jourdain at kitware.
> com>:
>
>> Hi Csaba,
>>
>> I'm hoping that /usr/local was empty as the VTK_JAVA_CLEANUP_INSTALL
>> property will wipe that directory before packaging the jars and so on.
>> Usually, when using VTK_JAVA_CLEANUP_INSTALL a local dedicated directory
>> is set to CMAKE_INSTALL_PREFIX. Then you can copy its content anywhere else.
>>
>> Regarding your issue I believe that you have all library names. Instead
>> you should be using the helper enum vtkNativeLibrary. Which can be used
>> like in our Demo example here: https://github.com/Kitwa
>> re/VTK/blob/master/Wrapping/Java/vtk/sample/Demo.java#L51-L61
>>
>> Seb
>>
>> On Sat, Apr 8, 2017 at 5:37 PM, Csaba Vörös <voroscsaba.kanizsa at gmail.com
>> > wrote:
>>
>>> Dear VTK Developers!
>>>
>>> I am a BsC student and now I'm writing my degree thesis. I programming
>>> in Java and I would use the vtk for the visualize my 3D model. I use MacOS
>>> 10.12.2 (Sierra).
>>> I downloaded from the web the latest version of VTK and I followed the
>>> instruction of vtk wiki. I configured the building with CMake and I used
>>> make command to compiling. After that I installed the vtk with make install
>>> command. In the terminal appeared the /usr/local/lib folder with the
>>> vtk.jar and .dylib files.
>>> At the CMake step I signed over the default ON variables the
>>> VTK_WRAP_JAVA, VTK_JAVA_INSTALL, VTK_JAVA_CLEANUP_INSTALL fields. I added
>>> the following variables to CMake correspond to VTK wiki and signed ON:
>>> DVTK_USE_QVTK, DVTK_USE_CARBON, DVTK_USE_GUISUPPORT and
>>> DCMAKE_INSTALL_PREFIX=/usr/local.
>>>
>>> I use NetBeans development environment and I setted up the vtk.jar to
>>> the Libraries and I added the following Virtual Machine options:
>>> -Djava.library.path="/usr/local/natives-Darwin-x86_64"
>>>
>>> When I would run a a simple code thrown the following exception:
>>> Exception in thread "main" java.lang.UnsatisfiedLinkError: no
>>> vtkCommonJava in java.library.path
>>>
>>> The source code contain this:
>>>  static {
>>>     System.loadLibrary("vtkCommonJava");
>>>     System.loadLibrary("vtkFilteringJava");
>>>     System.loadLibrary("vtkIOJava");
>>>     System.loadLibrary("vtkImagingJava");
>>>     System.loadLibrary("vtkGraphicsJava");
>>>     System.loadLibrary("vtkRenderingJava");
>>>   }
>>>
>>> I have no idea what is the solution for this problem.
>>>
>>> Thank you for taking the time to read my letter.
>>>
>>> Csaba Vörös
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Search the list archives at: http://markmail.org/search/?q=
>>> vtk-developers
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170411/1fb17742/attachment-0001.html>


More information about the vtk-developers mailing list