>So as I have described with Python I compiled VTK, but this time I included the java wrapping. Great the keys were getting all of the java environment variables correct. Here they are:
JAVA_INCLUDE_PATH, points to location of the file jni.h ie
/usr/lib/jvm/java-6-sun-1.6.0.07/include
JAVA_INCLUDE_PATH2, points to location of the file jni_md.h, which is a system specific file.
/usr/lib/jvm/java-6-sun-1.6.0.07/include/linux/
JAVA_AWT_INCLUDE_PATH, points to the location of jawt.h
/usr/lib/jvm/java-6-sun-1.6.0.07/include/jni.h
JAVA_AWT_LIBRARY, points to a libjawt.so
/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/i386/libjawt.so
JAVA_JVM_LIBRARY, points to the libjvm.so
/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/i386/client/libjvm.so
The next step got a little more rough. Again as with python you need to set your environment variables AND you have to load the library files from inside of your java program.
'Exception in thread "main" java.lang.UnsatisfiedLinkError: no vtkCommonJava in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1030) at new_cone.<clinit>(new_cone.java:4)\n'
This is take care of by setting the following environment variables:
export LD_LIBRARY_PATH={vtk_install}/bin:/usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/i386/xawt/
the first directory has your lib*Java.so.* files in it, while the second directory has the file "libmawt.so", if you don't have the second directory you will get the following error:
'Exception in thread "main" java.lang.UnsatisfiedLinkError: {vtk_install}/libvtkRenderingJava.so.5.2.1: libmawt.so: cannot open shared object file:
Now with the environment paths configured correctly you are still going to get an unsatisfied link error, so you have to load your libraries:
static { System.out.println("works to here"); System.loadLibrary("vtkCommonJava"); System.loadLibrary("vtkFilteringJava"); System.loadLibrary("vtkIOJava"); System.loadLibrary("vtkImagingJava"); System.loadLibrary("vtkGraphicsJava"); System.loadLibrary("vtkRenderingJava"); }
So easy and yet it can take some time to figure out. Lastly here is an example using the window interactor. new_cone.java
Note you should have some examples that come with your vtk installation, If I had started from these I would have been done much quicker.