[vtkusers] Solving general issues in compiling VTK with Java Wrapping on Windows !

Sebastien Jourdain jourdain at artenum.com
Wed May 27 17:16:21 EDT 2009


I've finally found a solution to my previous issues where I wanted to  
produced a VTK for windows with Java wrapping that could work on any  
Windows of the same kind.

First of all : Never use Visual Studio Express (any version) if you  
want to distribute your code. It won't work on the targeted windows if  
they don't have a Visual Studio Express installed.

Therefore you have to use a C++ compiler that allow redistribution of  
the produced binary. I've used the Borland one. But the compilation  
was not strait forward. I had to convert the file jawt.lib with a tool  
provided with borland called coff2mof and used the converted file in  
the CMake for the compilation.

Once the compilation is done and works locally it has a great chance  
that it won't work on Windows that don't have C++ tools.

To solved the portability issue, I've used the "Dependency Walker"  
tool to look into the dll files and check the missing one. And I've  
found that the vtkCommon was using the cc3280mt.dll that was on the  
computer used for the compilation but not on standard Windows. So I've  
added the file in my VTK package inside the bin directory with the  
other VTK dll's.

At this point you are quite close to success ! But, on some computer  
you might get an error during the loading of the vtkRendering library  
specially if you use a script that append on the head or at the tail  
of the PATH the directory that contains the vtk dll before launching  
your java application.

To solved this last error I've made a script that override the whole  
PATH environment variable with only the directory that own the VTK dll  
and a full path to the java executable of the JRE to execute my  
application.

like :
set PATH=..\vtk
c:\jre1.6\bin\java -cp .;..\vtk.jar  your.package.name.MainClass

Instead of :
set PATH=..\vtk;%PATH%
java -cp .;..\vtk.jar  your.package.name.MainClass

And know, it works on all the 5 computer that I could used for my  
test. Of course I can't guaranty that it is the absolute solution, but  
right know, for me, it seems to work !

I would like to thanks Frederic Danesi who give me some good clues on  
my issues after that I've posted on the VTK mailing list. (He directly  
replied to me in french ;-)

So, I hope this could help someone someday...

Sebastien Jourdain



More information about the vtkusers mailing list