Thursday, August 11, 2005

VTK Java Installation on RH 9 and Debian

So at home I am using Debian and at work we are using Redhat. Both systems are completely different and coming from Debian Redhat looks pretty weird.

First of all both systems don't come with a decent Java installation. RH seems to put per default the gcj-stuff on I could rant about for hours. Anyway you will have to download the JDK from SUN and install it. On Debian I used the tar.gz version which did a fabulous job -- on RH I used the .rpm version which just threw the whole installation in /usr/java and left the gcj stuff intact, e.g. /usr/bin/java links to gcj...

Then you download VTK (Version 4.4) and Cmake, follow the instructions, enter ccmake . and then use "t" to change some things in the expert mode (especially RH tends to put in the gcj stuff so be sure to do that and also make ln -sf /usr/java/j2sdk<your favorite version> /usr/local/java)

Java-Settings (Debian):
JAVACOMMAND /usr/local/java/bin/java
JAVA_ARCHIVE /usr/local/java/bin/jar
JAVA_AWT_INCLUDE_PATH /usr/local/lib/java/include
JAVA_AWT_LIBRARY /usr/local/lib/java/jre/lib/i386/libjawt.so
JAVA_COMPILE /usr/local/java/bin/javac
JAVA_INCLUDE_PATH /usr/local/lib/java/include
JAVA_INCLUDE_PATH2 /usr/local/lib/java/include/linux
JAVA_RUNTIME /usr/local/java/bin/java


Normal Settings (no "t")

BUILD_EXAMPLES ON
BUILD_SHARED_LIBS ON
CMAKE_BACKWARDS_COMPATIBILITY 2.2
CMAKE_BUILD_TYPE
CMAKE_INSTALL_PREFIX /usr/local
VTK_DATA_ROOT ../VTKData-release-4-2
VTK_USE_HYBRID ON
VTK_USE_PARALLEL OFF
VTK_USE_PATENTED ON
VTK_USE_RENDERING ON
VTK_WRAP_JAVA ON
VTK_WRAP_PYTHON OFF
VTK_WRAP_TCL OFF


After a couple of configures you can finally hit generate and the system will generate the makefiles. Run make and a long coffee break later you should have something compiled.

Adjust the LD_LIBRARY_PATH to include <Your favorite VTK installation path>/bin and off you go for your first test ride. Well, you might want to add the VTK Java Examples and then you will have to do the following additional steps:


mkdir classes/
cp ~/VTK/Wrapping/Java/vtk/* ~/VTK/java/vtk/
cp ~/VTK-Examples/Wrapping/Java/vtk/* ~/VTK/java/vtk/
cd ~/VTK/java/vtk
mv vtkSettings.java.in vtkSettings.java
cd ..
/usr/local/java/bin/javac -d classes/ vtk/*.java
/usr/local/java/bin/javac -d classes/ vtk/util/*.java
cd classes/
/usr/local/java/bin/jar cvf vtk.jar vtk/
/usr/local/java/bin/jar i vtk.jar
cp vtk.jar ../../bin/


This allow you to just import vtk.jar as an external jar in eclipse to use all the things in vtk.util.

Hopefully that works out for you. Let me know if you have any trouble and I might follow up in this blog.

1 Comments:

Blogger Javier said...

I think you forgot a -r flag

cp -r ~/VTK-Examples/Wrapping/Java/vtk/* ~/VTK/java/vtk/

is the third line of the command sequence you show.

Besides that, thanks for the help! I was a bit stuck with the .in java file.

¿Is renaming the .in file like that the by-the-book solution? ¿or is it a hack?
Anyway, it has worked for me. Again, thanks

1:47 PM

 

Post a Comment

<< Home