[Gdal-dev] GDAL Java Binding on Linux
Daniele Romagnoli
dany.geotools at gmail.com
Fri Aug 17 08:32:44 EDT 2007
Hi list.
I tried to build and use GDAL with the Slackware distribution from another
laptop.
I firstly configured GDAL, then I built it.
Finally, I produced SWIG bindings and I launched a java test application
similar to GDALInfo with a BMP file.
Everything works fine... No strange JVM errors occurred.
Then, I configured GDAL to support MrSID and I built it again (after a
CLEAN). I generated swig bindings and I launched a similar java test
application with a MrSID file and everything works fine again.
So, I think my problem could be related to Fedora Core 6 distribution and
its libs.
Prior to add MrSID support, I would like to be able of using GDAL from java
without errors. (adding MrSID support will be done in a second moment).
Could someone give me a little help?
There is someone here which successfully built GDAL and used it from Java
with FedoraCore6?
Thx a lot for your attention.
Best Regards,
Daniele Romagnoli
On 8/13/07, Daniele Romagnoli <dany.geotools at gmail.com> wrote:
>
> Thx a lot for your suggestions.
>
> In my previous attempts, I already tried your solution by setting (under
> eclipse) the VM arguments with the java library path variable, properly
> linking to a shared folder.
> However, even without MrSID support, I have the same problem.
>
> So, my first objective is understanding how to make GDAL working without
> MrSID from java.
> Then, I will add again MrSID support.;)
>
> Thx for your help.
>
> Regards,
> Daniele
>
>
> On 8/13/07, Collins, Benjamin <collinsb at mitre.org> wrote:
> >
> > 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
> > >
> >
>
>
>
> --
> Best Regards,
> Daniele Romagnoli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070817/ca229f1a/attachment.html
More information about the Gdal-dev
mailing list