[gdal-dev] Using Java bindings of GDAL library : UnsatisfiedLinkError
Kedar Deshpande
kedardeshpande87 at gmail.com
Fri Jun 8 18:54:19 PDT 2012
Hi,
I am writing a simple program to read a shapefile in Java on my linux
machine using the gdal library's Java bindings.
I followed the steps according to the link
http://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix given on
the GDAL library's site.
In the gdal folder in gdal/swig/java, I made changes in java.opt and the
ran 'make' command.
Then I wrote a simple program under /apps folder as :
package apps;
import org.gdal.ogr.DataSource;
import org.gdal.ogr.ogr;
public class TestClass {
public static void main(String[] args) {
ogr.RegisterAll();
}
}
and ran it as
javac apps/TestClass.java
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:`pwd`
java -classpath `pwd`/gdal.jar:`pwd`:`pwd`/apps TestClass
but I am getting UnsatisfiedLinkError after running it.
Native library load failed.
java.lang.UnsatisfiedLinkError: no ogrjni in java.library.path
Exception in thread "main" java.lang.UnsatisfiedLinkError:
org.gdal.ogr.ogrJNI.RegisterAll()V
at org.gdal.ogr.ogrJNI.RegisterAll(Native Method)
at org.gdal.ogr.ogr.RegisterAll(ogr.java:110)
at apps.TestClass.main(TestClass.java:9)
Is there anything I am missing in this configuration?
I have the libgdal.la library files in my PATH env variable. (I am
running it on RHEL5)
Can some please let me know how do I get rid of this exception and
make it link to the library?
Thanks,
Kedar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120608/29707cac/attachment.html>
More information about the gdal-dev
mailing list