Hi,

They use SWIG (an interface compiler - http://www.swig.org) to generate JNI
(Java Native Interface) code to access GDAL's C++ code from java.
Usually, a JNI works this way: you have the initial C/C++ code (and possibly
a C/C++ library), a Java code that declared a native method (ressembing
this: private native void MyMethod(...); static
{System.loadLibrary("myClibrary");} ) and finally a JNI code that makes the
interface between the 2 codes (C/C++ and Java).
Similarly, in the case of the GDAL Java Bindings, you have the original gdal
library files, the java code (in gdal.jar) and the four library files
(libgdalconstjni.so, libgdaljni.so, libogrjni.so and libosrjni.so under
linux) which contain the JNI.

To make things clear, the binaries available from
http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries are gdal's binary
(i.e. libgdal1.x.x.so, libgdal1.x.x.a, libgdal1.x.x.la and so on). To the
best of my knowledge (which isn't saying much), to build the jar and the
others libraries, you need to compile them for yourself. To do so, you
should get the sources from the svn repository, either the latest or the
latest stable release :

  svn checkout https://svn.osgeo.org/gdal/trunk/gdal gdal
  svn checkout https://svn.osgeo.org/gdal/branches/1.6/gdal gdal

As I was curious, I just compiled gdal java bindings on Ubuntu 9.04 and it
worked just fine.
To be exhaustive, once I got the latest code from the svn repository, I ran
:
cd gdal
./configure
make
(that builds the entire gdal library from code)
cd swig/java/
(here, you need to edit the java.opt file to set the JAVA_HOME variable
properly)
make
(there, you have everything you need, now I'm just trying to use ogrinfo
from java)
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:`pwd`
java -classpath ./gdal.jar:./build:./build/apps ogrinfo
~/data/testShapefile.shp

whch returns :
INFO: Open of `/home/julien/data/testShapefile.shp'
      using driver `ESRI Shapefile' successful.
1: testShapefile (Polygon)


I hope that helps...

Julien
PS: I can send you my compiled gdal.jar and the 4 so files if you have a
compatible linux version...

2009/6/12 Stefan Steiniger <sst...@geo.uzh.ch>

> but gdal shouldn't have any java files, i.e. jars.
> What is used is something like a "bridge" to access the code in the .dll
> or .so files. This bridge is of course in java, i.e. in a jar.
> I would think you only need to replace the dll files by the so files and
> everything else would work. but maybe I am wrong, since I never used
> something like this.
>
> Giuseppe Aruta wrote:
> > Hi Stefan,
> > As I understand from these pages (
> http://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructions and
> http://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix), gdal
> for java (windows or linux) must be compiled from the source code.
> > A gdal.jar is build. On windows it creates new dll files
> (gdalconstjni.dll, gdaljni.dll, ogrjni.dll, osrjni.dll). On Linux it creates
> some lib files (libgdalconstjni.so, libgdaljni.so, libogrjni.so and
> libosrjni.so).
> > As far as I understand, the adbtoolbox grid file extension needs jav gdal
> + library files. I have only the windows ones. My idea was to find the linux
> ones and test if it works.
> >
> > BTW I gave a look to the class files of this extension and  translated
> some menus from Italian to English. How can I set the "international" codes?
>
> I am not sure if I understand your question?
> - the java *.class files or *.java files?
> - could you use the i18n startup option or dUser?
>
> stefan
>
> >
> > regards
> >
> > Peppe
> >
> >
> > --- Ven 12/6/09, Stefan Steiniger <sst...@geo.uzh.ch> ha scritto:
> >
> >> Da: Stefan Steiniger <sst...@geo.uzh.ch>
> >> Oggetto: Re: [JPP-Devel] gdal  java build for linux
> >> A: "OpenJump develop and use" <jump-pilot-devel@lists.sourceforge.net>
> >> Data: Venerdì 12 giugno 2009, 00:37
> >> Hei Peppe,
> >>
> >> why you are not using one of those?:
> >>
> >> http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
> >>
> >> stefan
> >>
> >> Giuseppe Aruta wrote:
> >>> Hi all,
> >>> I am looking for a a compiled gdal for linux java.
> >>> This is the page:
> http://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix
> >>>
> >>> Does anybody has a copy or know where to find it?
> >>>
> >>> Regards
> >>>
> >>> Peppe
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> ------------------------------------------------------------------------------
> >>> Crystal Reports - New Free Runtime and 30 Day Trial
> >>> Check out the new simplified licensing option that
> >> enables unlimited
> >>> royalty-free distribution of the report engine for
> >> externally facing
> >>> server and web deployment.
> >>> http://p.sf.net/sfu/businessobjects
> >>> _______________________________________________
> >>> Jump-pilot-devel mailing list
> >>> Jump-pilot-devel@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>>
> >>>
> >>
> ------------------------------------------------------------------------------
> >> Crystal Reports - New Free Runtime and 30 Day Trial
> >> Check out the new simplified licensing option that enables
> >> unlimited
> >> royalty-free distribution of the report engine for
> >> externally facing
> >> server and web deployment.
> >> http://p.sf.net/sfu/businessobjects
> >> _______________________________________________
> >> Jump-pilot-devel mailing list
> >> Jump-pilot-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Crystal Reports - New Free Runtime and 30 Day Trial
> > Check out the new simplified licensing option that enables unlimited
> > royalty-free distribution of the report engine for externally facing
> > server and web deployment.
> > http://p.sf.net/sfu/businessobjects
> > _______________________________________________
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
> >
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>



-- 
Julien Perret
Tel (work): +33 1 43 98 84 09
Fax (work): +33 1 43 98 85 81
Mobile: +33 6 68 74 82 31
Email: julien.per...@gmail.com
Homepage: http://julien.perret.googlepages.com
Professional Homepage:
http://recherche.ign.fr/labos/cogit/cv.php?prenom=Julien&nom=Perret
ThinkCollabs Homepage: http://thinkcollabs.org
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to