[vtkusers] Using VTK w/ Java - Can't get past VtkInit error

Fran Fabrizio fran at cis.uab.edu
Fri Dec 5 18:33:48 EST 2003


Ok, I have made a breakthrough - I can get it to work under very
specific circumstances...so I rebuild VTK, and then do a "make install".
As we know, this doesn't actually move the vtk.jar anywhere.  But,
before I move it somewhere more permanent, let's try this and just point
the CLASSPATH to the 'vtk/linux/bin' build directory where it made
vtk.jar:

# cd ~/VTK/Step1/Java
# javac -classpath .:/usr/local/src/vtk/linux/bin/vtk.jar Cone.java
# java -classpath .:/usr/local/src/vtk/linux/bin/vtk.jar Cone

WOOHOO it works when I do it this way!  But then when I try to mov ethe
vtk.jar to somewhere more permanent, like in my java install to
somewhere like /ext where it'll be in the default classpath.....
 
# cd /usr/local/java/jre/lib/ext
# cp /usr/local/src/vtk/linux/bin/vtk.jar . 
# cd ~/VTK/Step1/Java
# java Cone
Exception in thread "main" java.lang.UnsatisfiedLinkError: VTKInit
        at vtk.vtkConeSource.VTKInit(Native Method)
        at vtk.vtkObject.<init>(vtkObject.java:98)
        at vtk.vtkProcessObject.<init>(vtkProcessObject.java:86)
        at vtk.vtkSource.<init>(vtkSource.java:86)
        at vtk.vtkPolyDataSource.<init>(vtkPolyDataSource.java:30)
        at vtk.vtkConeSource.<init>(vtkConeSource.java:114)
        at Cone.main(Cone.java:34)

Boohoo so it's broken here. :-(  I'll be more explicit:

# java -classpath .:/usr/local/java/jre/lib/ext/vtk.jar Cone
Exception in thread "main" java.lang.UnsatisfiedLinkError: VTKInit
        at vtk.vtkConeSource.VTKInit(Native Method)
        at vtk.vtkObject.<init>(vtkObject.java:98)
        at vtk.vtkProcessObject.<init>(vtkProcessObject.java:86)
        at vtk.vtkSource.<init>(vtkSource.java:86)
        at vtk.vtkPolyDataSource.<init>(vtkPolyDataSource.java:30)
        at vtk.vtkConeSource.<init>(vtkConeSource.java:114)
        at Cone.main(Cone.java:34)

Huh?  The classpath is pointing at the same exact .jar file, just living
in a different directory!  Why does it break now?

So, I'm happy that I have -seen- it work, but baffled as to why it only
works when the vtk.jar is in the VTK build directory.  That's less than
ideal to say the least. :-)

Any thoughts?

Thanks,
Fran






More information about the vtkusers mailing list