[vtkusers] A step forward and stuck again: VTK, Mac OS, Java, SOLVED! partially

Bernard Giroux giroux at geo.polymtl.ca
Tue Feb 20 08:28:38 EST 2007


Kustaa Nyholm a écrit :
>>>> Bernard Giroux <giroux at geo.polymtl.ca> 19.2.2007 17:07 >>>
> 
>> Does DYLD_LIBRARY_PATH contains the directory where *jnilib and *dylib
> are?
> Ah, great suggestion, this cured the problem!
> BTW isn't there something wrong if I need that? Knowing nothing about
> this (I assume it
> is some python stuff) I googled about a bit on this and someone said
> that
> it should not be necessary to set this if everything is configured
> properly, what ever
> that means...

You built shared libraries, and DYLD_LIBRARY_PATH is the OSX way to tell 
your apps where the libraries are.  Besides, if you select VTK_USE_RPATH 
in your cmake config, then you don't have to define DYLD_LIBRARY_PATH.

> 
> But the great thing is that I I *can* now compile and run VTK using
> Java on Mac OS!
> 
>  It does not work yet, though, :-(
> 
> Nothing happens when I try the sample code.
> 
> 
> But to recap success so far, for the benefit of those who may read this
> later:
> 
> I'm working with:
> 
> VTK 5.0.2 from source code
> Mac OS X 10.4.8 (on Dual Core Intel)
> CMake 2.4.6 using binary from Mac .dmg image
> Java version 1.5.0_07
> JRE build 1.5.0_07-164
> Hot Spot 1.5.0_07-87

I have the same setup.

> 
> To get it to compile I did the following AFAIK:
> 
> ccmake .
>    BUILD_SHARED_LIBS ON
>    VTK_WRAP_JAVA ON
>    JAVA_AWT_INCLUDE_PATH
> /System/Library/Frameworks/JavaVM.framework/Headers
>    [c]onfigure and [g]enerate
> 
> then edited manually CMakeCache.txt to add the following entry:
> 
> JAVA_AWT_LIBRARY:STRING=-framework JavaVM
>    
> after which I was able to compile it with make
> 
> To be able to run it (in Eclipse) I did the following:
> 
> project->properties->java build path->libraries->ddd external jar->
> browse to /Users/username/vtk/bin/vtk.jar
> 
> expand the vtk.jar in the same dialog, double click on the native
> library location and enter /Users/username/vtk/bin
> 
> create a run/debug configuration and in the Environment tab add
> DYLD_LIBRARY_PATH with value /Users/username/vtk/bin
> 
> Now the code compiles and executes but nothing happens! 
> 
> the code I'm running is verbatim from 
> http://public.kitware.com/VTK/example-code.php 
> 
> Single stepped through it and the libraries get loaded and no
> exceptions are reported but the code seems to hang inside
> the very last call of the program which calls
> vtkRenderWindowInteractor.start(). The application does not quit and is

I experienced the same with that sample code.  I think the problem is 
with the implementation of vtkRenderWindowInteractor.  In order to have 
window interaction, I extend vtkPanel (look at the vtkPanel.java code, 
it fairly straigthforward to understand).

Perhaps you can try some examples without window interaction first to 
confirm the usability of your setup, and then dig deeper...

Good luck.

> consuming no CPU time but nothing is seen. Need to dig deeper to this,
> just rushed off to report success so far 
> and thank everybody. Having said that I would love to get some pointers
> forward...
> 
> br Kusti
> 
> 
> 
> 
> 
> 
> Kustaa Nyholm
> Research Manager, Software
> Research and Technology Division
> PLANMECA OY
> Asentajankatu 6
> 00880 HELSINKI
> FINLAND
> 
> Please note our new telephone and fax numbers!
> Tel: +358 20 7795 572 (direct)
> Fax: +358 20 7795 676
> GSM: +358 40 580 5193
> e-mail: kustaa.nyholm at planmeca.com 
> 
> This e-mail may contain confidential or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden. We will not be liable for direct,
> indirect, special or consequential damages arising from alteration of
> the contents of this message by a third party or as a result of any
> virus being passed for viruses.
> 
> 
> 


-- 
Bernard Giroux, ing., Ph.D.
Associé de recherche

http://geo.polymtl.ca/~giroux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3253 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070220/8c1c85e3/attachment.bin>


More information about the vtkusers mailing list