[Gdal-dev] GDAL Java Binding on Linux

Collins, Benjamin collinsb at mitre.org
Mon Aug 13 09:34:20 EDT 2007


Because of the GCC version mismatch between the MrSID DSDK and modern
Linux distros, I have not had the chance to get MrSID going either.  I
would note, however, that generally one should add a parameter to the
jvm like:
  -Djava.library.path=<relative path to libs>
instead of copying the libraries to a shared location.

On Windows, the MrSID DSDK requires an additional library (DLL) be
present at runtime.  Since the GDAL binding is the one that 'loads' it,
the -D flag will generally not help finding it, unless you artificially
load it yourself in java before GDAL tries to.  This can be
accomplished with a call like:
  System.loadLibrary("lti_dsdk_dll"); //FOR WINDOWS, pre-load the DSDK
  gdal.AllRegister();			//then start GDAL
This works on Windows, something like it may be necessary on Linux.

Sorry I could not provide more specifics.  If you got MrSID compiled in
at all, you're probably close to success.
--
Ben

>-----Original Message-----
>From: gdal-dev-bounces at lists.maptools.org 
>[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of 
>Daniele Romagnoli
>Sent: Monday, August 13, 2007 6:36 AM
>To: gdal-dev at lists.maptools.org
>Subject: [Gdal-dev] GDAL Java Binding on Linux
>
>Hi guys. 
>I have some problems using GDAL java bindings on linux.
>
>I'm using Fedora Core 6.
>I downloaded GDAL from SVN, TAG 1.4.2.
>I added MrSID support and I built GDAL. (I downloaded the 
>GeoDSDK from Lizardtech, version 6.0.7.1047, for linux x86.gcc34)
>
>It works fine... I can successfully use gdalinfo with a MrSID 
>file sample.
>
>The GDAL/.libs folder contains 3 files: libgdal.so.1.11.2, 
>libgdal.so and libgdal.so.1 (last 2 are symbolic links) 
>Next step is building Java Binding through SWIG.
>
>I launched:
>cd swig
>gmake
>cd java
>gmake
>
>I built the 4 .so (libgdaljni.so, libgdalconstjni.so, 
>libogrjni.so and libosrjni.so) without any error. 
>
>Then, I put all .SO and Lizardtech lib in 
>java/JDKversion/jre/lib/i386 and launched eclipse.
>I written a little section of code which uses GDAL and I 
>received the error in the attached file.
>
>Since I'm not an expert Linux user, I'm surely doing some wrong
things.
>
>Somewhere, I read that I would have to build GDAL with the 
>same version of GCC used to build the MrSID lib provided by 
>lizardtech. 
>Fedoracore6 uses GCC 4.1.1 but, checking some forums, I think 
>that this error is unrelated with the gcc version but is 
>simply an error due to a wrong use of the .so.
>
>As my last recent attempt, I built GDAL without MrSID support 
>and tried the GDALTest java application available in 
>gdal/swig/java but I received the same error.
>The strange thing is that GDALTest successfully call 
>gdal.AllRegister() as well as gdal.getDriverCount() and 
>similar things. 
>Furthermore, I open a BMP file and I successfully obtain a 
>Dataset instance (Not null). 
>The error occurs when the code does: dataset.getDriver ()
>
>So, I'm pretty sure I'm wrong in the use of the .SO. 
>Any suggestion/question to help me solving my problems?
>
>Thank you very much.
>
>
>-- 
>Best Regards,
>Daniele Romagnoli 
>




More information about the Gdal-dev mailing list