[vtkusers] VTK and Java
Raphael Sebbe
sebbe at multitel.be
Mon Jul 8 03:07:56 EDT 2002
Hi,
I try to use VTK from Java on Mac OS X. There are some changes that are
needed for it to compile and work properly, so, what is the best way to
contribute them back ?
They are mainly related to
- jni.h path (and others)
- Mac OS X uses .jnilib as native shared library extension, using .dylib
(standard on OS X) means the Java VM won't be able to load the native
code.
- adding "-framework JavaEmbedding.framework" to the linker flags
- It seems to me the mutex "vtkGlobalMutex" is not properly initialized
in vtkJavaUtil.cxx
- In the same file, I added "|| defined(__MACH__)" on line 57, as OS X
uses pthreads as well
- I saw in one file (don't remember which one) that a correspondance was
made between Java AWT frame and native one, I guess this could be easily
implemented if one chooses Carbon backend as Java AWT is implemented in
terms of Carbon (and appropriate definitions can be found in jawt_md.h
I am not fluent at all with CMake, but I guess most environment changes
should be handled there.
Also, I came across a problem when using Java, I have to explicitely
invoke VTKInit() on each new Java instance of VTK classes, as it is not
called from the Java constructor (as far as I can see from a cross
Java/GDB debugging session). Otherwise I get a bad access on the first
VTK function call, as it can't establish the Object <-> Pointer
relation. This was not the case on the last nightly build I used (I am
now working from CVS), and as a result, java examples and tutorials do
not work. Any idea ?
Thanks,
Raphael Sebbe
More information about the vtkusers
mailing list