GDAL Java Bindings

eightysteele edited this page Jun 28, 2012 · 2 revisions
Clone this wiki locally


Gulo, the VertNet harvester, uses Cascalog for running MapReduce queries, and we need Java GDAL bindings, so they need to be built. Here are the steps for Ubuntu.


Before building, we'll need PROJ4 for reprojection support, so let's get that installed first:

$ curl -O
$ tar xvfz proj-4.8.0.tar.gz
$ cd proj-4.8.0
$ ./configure
$ make
$ sudo make install

That installs the native libraries in /usr/local/lib/libproj*. Now we're ready for GDAL! Buuut, if you see any unexpected errors, try a sudo apt-get install proj4.

First download, configure, and make GDAL:

$ curl -O
$ tar xvfz gdal-1.9.1.tar.gz
$ cd gdal-1.9.1
$ ./configure --with-static-proj4=/usr/local --with-java=yes
$ make

Next edit gdal-1.9.1/swig/java/java.opt with your JAVA_HOME path:

JAVA_HOME = "/usr/lib/jvm/java-6-openjdk-amd64"
JAVA_INCLUDE=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux

Almost there! Just make it:

$ cd gdal-1.9.1/swig/java/
$ make

And finally copy the resulting .so files into a directory and update your LD_LIBRARY_PATH environment variable to point to them:

$ cd /gdal-1.9.1/swig/java
$ ls | grep .so
$ cp *.so ~/opt/linuxnative/
$ export LD_LIBRARY_PATH=~/opt/linuxnative/ # Put this in .bashrc