[Insight-users] Java Wrappers

Brad King brad.king at kitware.com
Thu, 26 Feb 2004 09:31:59 -0500


Alejandro Canales Ochoa wrote:
> Hi
> 
>  I just followed your instructions and I have a working installation of ITK with java wrappers.  I found a couple of issues in the process: 
> 
> 	The file CableSwig\GCC\libiberty\floatformat.c did not compile due an error. The definition _STDC_ is not defined in the compilation environment, so the precompiler redefines memcpy and memset:
> 
> #ifdef __STDC__
> #include <stddef.h>
> extern void *memcpy (void *s1, const void *s2, size_t n);
> extern void *memset (void *s, int c, size_t n);
> #else
> extern char *memcpy ();
> extern char *memset ();
> 
> I just comment out this portion of code and the compilation works fine. I am using Visual C++ 6.0 with any patch applied. I am downloading the Service Pack 5 for Visual C++ and I will try to recompile with the portion of code as it comes from the CVS.

This program has been built on MSVC 6 many times.  Please try it again 
after upgrading to service pack 5.

> 	The second issue: After the compilation succeed, I move the jar (InsightToolkit.jar) and the corresponding Dll’s from the build path to another directory. When I run my first program, the java runtime was unable to load the native libraries, no mater I correctly set my CLASSPATH and my PATH (currently I use windows) environment variables to the directory where I move the files.
> 	I look the source code of a class named itkbase  and I see that the class expects the Dlls to be in the installation directory, so I point my library path to this directory and voila!, it works!. I think that hard coding the path of the Dlls in this class removes flexibility to the applications developed with the ITK java Wrappers.

This also lets it work from the build tree out of the box without 
setting anything but the classpath to point at the jar.  What it should 
probably do is look in the directory containing the jar first, and then 
in the hardcoded path.  Please add this as a feature request to the bug 
tracker at

   http://www.itk.org/Bug

Thanks,
-Brad