[vtkusers] Problem installing VTK java extensions in windows

Randy Heiland heiland at ncsa.uiuc.edu
Wed Jun 21 10:02:26 EDT 2000


> I get error:
>     Exception in thread "main" Java.lang.UnsatisfiedLinkError: VTKInit
>            at vtk.vtkObject.<init>(vtkObject.Java:77)
>            at Test.main(Test.Java:6)
>
>
> So If any one can help it would be very much appreciated,
> Bradley Crouch



First of all, nevermind the deprecation warnings for now (but feel free to test
out updated methods that are suggested and let us know).

To the more serious  Java.lang.UnsatisfiedLinkError: VTKInit,  let's look at
what's going on.  This unfortunately gets into JNI (Java Native Interface, the
way Java code connects to non-Java code).  I'll explain my setup on a Unix box
(it's working for me) - you translate to Windows syntax.

In  .../vtk/java/vtk/*.java, you should have VTKInit declared, as a native
method, in every(?) class:
% grep VTKInit *.java
vtk3DSImporter.java:  public native void   VTKInit();
 ...
vtkXYPlotActor.java:  public native void   VTKInit();

(it actually gets called in only a few classes:)
% grep VTKInit *.java|grep this
vtkIndent.java:  public vtkIndent() { this.VTKInit();};
vtkObject.java:  public vtkObject() { this.VTKInit();};
vtkTimeStamp.java:  public vtkTimeStamp() { this.VTKInit();};


Let's take vtkSphereSource.java as an example.  If you then go to
.../vtk/graphics/java, you should have  vtkSphereSourceJava.cxx  where the
following method should be defined:

extern "C" JNIEXPORT void JNICALL Java_vtk_vtkSphereSource_VTKInit(JNIEnv *env,
jobject obj)

(see any Java book that discusses JNI, or rf.
http://java.sun.com/docs/books/tutorial/native1.1/index.html)


IF all this stuff is in place, then the build should have created a
 libvtkJava.so (.dll for Windows), and the path to this lib needs to be
"findable" when your app is run.

hope this helps a little,
--Randy






More information about the vtkusers mailing list