[vtkusers] Catching VTK exceptions in Java

Mark Hünken mark.huenken at web.de
Mon Dec 8 06:19:40 EST 2003


"Steve Joyce" <Steve.Joyce at sercoassurance.com> schrieb am 08.12.03 10:10:18:

> My application code is in Java, but I presume I would have to set up
> the exception handlers in C++ and access them using JNI. Is that
> correct?

Exactly.  Actually, it's not that hard to accomplish. You have to register the JVM on the native side and setup the new exception handler, which propagates the catched exceptions to the JVM. You just have to find an appropriate vtk source file to include this or add a new one.

On the Java side you can simply try/catch your Update() calls then. I just implemented something like this and it works fine.

> >>> Jeff Lee <jeff at cdnorthamerica.com> 05/12/2003 17:49:26 >>>
> On second thought, mabey it isn't a good thing to have in vtk itself, 
> but is more appropriate in your application code.  

I see your concerns, but for me as a Java developer, who uses the Java wrapper to interface the vtk library, anything that has to be changed in native C++ code is per definition NOT part of the application. Of course, I already made several application specific patches to the vtk library, so I don't have to rely on any official vtk implementation, but this method is really not the original idea of using libraries...

So in my opinion, this is really low-tech (standard C++ as described in Bjarne Stroustroup's C++ bible, not much code), very handy and would be very neat to have in vtk.

Mark
______________________________________________________________________________
WEB.DE FreeMail wird 5 Jahre jung! Feiern Sie mit uns und
nutzen Sie die neuen Funktionen http://f.web.de/features/?mc=021130




More information about the vtkusers mailing list