One Star

Gdal Java Binding issue on OS X

Hello,
It's impossible to setup GDAL Java Binding on my computer max OS x 10.8.5

In talend (5.3.1 with spatial extension) the error message (on OgrInfoInput component) is :

Native library load failed.
java.lang.UnsatisfiedLinkError: no ogrjni in java.library.path
In order to use GDAL/OGR in Talend, the java.library.path variable should point to GDAL library.
To set this property, go to the Run view > Advanced settings > Use specific JVM Arguments
and add a new argument:
-Djava.library.path=/path/to/gdal/swig/java
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:115)
at gis_test.test_ogrinfo_0_1.test_ogrinfo.sOGRInfoInput_1Process(test_ogrinfo.java:707)
at gis_test.test_ogrinfo_0_1.test_ogrinfo.runJobInTOS(test_ogrinfo.java:1443)
at gis_test.test_ogrinfo_0_1.test_ogrinfo.main(test_ogrinfo.java:1291)
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:115)
at gis_test.test_ogrinfo_0_1.test_ogrinfo.sOGRInfoInput_1Process(test_ogrinfo.java:707)
connecting to socket on port 3788
connected
disconnected
at gis_test.test_ogrinfo_0_1.test_ogrinfo.runJobInTOS(test_ogrinfo.java:1443)
at gis_test.test_ogrinfo_0_1.test_ogrinfo.main(test_ogrinfo.java:1291)


I have compiled gdal-1.10.1 with no particular errors after installed swig and apply mac os x patch on java.opt: http://trac.osgeo.org/gdal/ticket/2401.
Directory gdal-1.10.1/swig/java contains :

|____.DS_Store
|____.libs
| |____gdal_wrap.o
| |____gdalconst_wrap.o
| |____libgdalconstjni.1.dylib
| |____libgdalconstjni.a
| |____libgdalconstjni.dylib
| |____libgdalconstjni.la
| |____libgdalconstjni.lai
| |____libgdaljni.1.dylib
| |____libgdaljni.a
| |____libgdaljni.dylib
| |____libgdaljni.la
| |____libgdaljni.lai
| |____libogrjni.1.dylib
| |____libogrjni.a
| |____libogrjni.dylib
| |____libogrjni.la
| |____libogrjni.lai
| |____libosrjni.1.dylib
| |____libosrjni.a
| |____libosrjni.dylib
| |____libosrjni.la
| |____libosrjni.lai
| |____ogr_wrap.o
| |____osr_wrap.o
|____add_javadoc.c
|____apps
| |____GDALContour.java
| |____GDALGrid.java
| |____gdalinfo.class
| |____gdalinfo.java
| |____gdalmajorobject.java
| |____GDALOverviews.java
| |____GDALProximity.java
| |____GDALtest.java
| |____GDALTestIO.java
| |____gdaltransformer.java
| |____ogr2ogr.java
| |____OGRFeature.java
| |____ogrinfo.java
| |____OGRTestGC.java
| |____ogrtindex.java
| |____OSRTransform.java
| |____ReadXML.java
| |____testgetpoints.java
| |____WKT2WKB.java
|____build
| |____apps
| | |____GDALContour.class
| | |____GDALGrid.class
| | |____GDALGridScaledProgress.class
| | |____gdalinfo.class
| | |____gdalmajorobject.class
| | |____GDALOverviews.class
| | |____GDALProximity.class
| | |____GDALScaledProgress.class
| | |____GDALtest.class
| | |____GDALTestIO.class
| | |____gdaltransformer.class
| | |____ogr2ogr$GeomOperation.class
| | |____ogr2ogr.class
| | |____OGRFeature$1.class
| | |____OGRFeature.class
| | |____ogrinfo.class
| | |____OGRTestGC.class
| | |____ogrtindex.class
| | |____OSRTransform.class
| | |____ReadXML.class
| | |____testgetpoints.class
| | |____WKT2WKB.class
| |____classes
| | |____org
| | | |____gdal
| | | | |____gdal
| | | | | |____AsyncReader.class
| | | | | |____Band.class
| | | | | |____ColorTable.class
| | | | | |____Dataset.class
| | | | | |____Driver.class
| | | | | |____GCP.class
| | | | | |____gdal.class
| | | | | |____gdalJNI.class
| | | | | |____MajorObject.class
| | | | | |____ProgressCallback.class
| | | | | |____RasterAttributeTable.class
| | | | | |____TermProgressCallback.class
| | | | | |____Transformer.class
| | | | | |____XMLNode.class
| | | | | |____XMLNodeType.class
| | | | |____gdalconst
| | | | | |____gdalconst.class
| | | | | |____gdalconstConstants.class
| | | | | |____gdalconstJNI.class
| | | | |____ogr
| | | | | |____DataSource.class
| | | | | |____Driver.class
| | | | | |____Feature.class
| | | | | |____FeatureDefn.class
| | | | | |____FeatureNative$1.class
| | | | | |____FeatureNative.class
| | | | | |____FieldDefn.class
| | | | | |____Geometry.class
| | | | | |____GeometryNative$1.class
| | | | | |____GeometryNative.class
| | | | | |____Layer.class
| | | | | |____ogr.class
| | | | | |____ogrConstants.class
| | | | | |____ogrJNI.class
| | | | | |____ProgressCallback.class
| | | | | |____TermProgressCallback.class
| | | | |____osr
| | | | | |____CoordinateTransformation.class
| | | | | |____osr.class
| | | | | |____osrConstants.class
| | | | | |____osrJNI.class
| | | | | |____SpatialReference.class
|____build.xml
|____const
| |____makefile.vc
|____gdal
| |____.DS_Store
| |____makefile.vc
|____gdal-package-info.java
|____gdal.jar
|____gdal_wrap.cpp
|____gdal_wrap.lo
|____gdal_wrap.o
|____gdalconst-package-info.java
|____gdalconst_wrap.c
|____gdalconst_wrap.lo
|____gdalconst_wrap.o
|____GNUmakefile
|____java.opt
|____javadoc.java
|____libgdalconstjni.dylib
|____libgdalconstjni.la
|____libgdaljni.dylib
|____libgdaljni.la
|____libogrjni.dylib
|____libogrjni.la
|____libosrjni.dylib
|____libosrjni.la
|____make_doc.sh
|____makefile.vc
|____ogr
| |____.DS_Store
| |____makefile.vc
|____ogr-package-info.java
|____ogr_wrap.cpp
|____ogr_wrap.lo
|____ogr_wrap.o
|____org
| |____gdal
| | |____gdal
| | | |____AsyncReader.class
| | | |____AsyncReader.java
| | | |____Band.class
| | | |____Band.java
| | | |____ColorTable.class
| | | |____ColorTable.java
| | | |____Dataset.class
| | | |____Dataset.java
| | | |____Driver.class
| | | |____Driver.java
| | | |____GCP.class
| | | |____GCP.java
| | | |____gdal.class
| | | |____gdal.java
| | | |____gdalJNI.class
| | | |____gdalJNI.java
| | | |____MajorObject.class
| | | |____MajorObject.java
| | | |____ProgressCallback.class
| | | |____ProgressCallback.java
| | | |____RasterAttributeTable.class
| | | |____RasterAttributeTable.java
| | | |____TermProgressCallback.class
| | | |____TermProgressCallback.java
| | | |____Transformer.class
| | | |____Transformer.java
| | | |____XMLNode.class
| | | |____XMLNode.java
| | | |____XMLNodeType.class
| | | |____XMLNodeType.java
| | |____gdalconst
| | | |____gdalconst.java
| | | |____gdalconstConstants.class
| | | |____gdalconstConstants.java
| | | |____gdalconstJNI.class
| | | |____gdalconstJNI.java
| | |____ogr
| | | |____DataSource.class
| | | |____DataSource.java
| | | |____Driver.class
| | | |____Driver.java
| | | |____Feature.class
| | | |____Feature.java
| | | |____FeatureDefn.class
| | | |____FeatureDefn.java
| | | |____FeatureNative$1.class
| | | |____FeatureNative.class
| | | |____FeatureNative.java
| | | |____FieldDefn.class
| | | |____FieldDefn.java
| | | |____Geometry.class
| | | |____Geometry.java
| | | |____GeometryNative$1.class
| | | |____GeometryNative.class
| | | |____GeometryNative.java
| | | |____Layer.class
| | | |____Layer.java
| | | |____ogr.class
| | | |____ogr.java
| | | |____ogrConstants.class
| | | |____ogrConstants.java
| | | |____ogrJNI.class
| | | |____ogrJNI.java
| | | |____ProgressCallback.class
| | | |____ProgressCallback.java
| | | |____TermProgressCallback.class
| | | |____TermProgressCallback.java
| | |____osr
| | | |____CoordinateTransformation.class
| | | |____CoordinateTransformation.java
| | | |____osr.class
| | | |____osr.java
| | | |____osrConstants.class
| | | |____osrConstants.java
| | | |____osrJNI.class
| | | |____osrJNI.java
| | | |____SpatialReference.class
| | | |____SpatialReference.java
|____osr
| |____.DS_Store
| |____makefile.vc
|____osr-package-info.java
|____osr_wrap.cpp
|____osr_wrap.lo
|____osr_wrap.o
|____overview.html
|____test_data
| |____.DS_Store
| |____byte.tif
| |____poly.dbf
| |____poly.shp
| |____poly.shx


Thanks for your help.
Eric.

4 REPLIES
One Star Fxp
One Star

Re: Gdal Java Binding issue on OS X

Hi, I've no mac for testing but did you also properly set "java.library.path" in job adv. settings:
Run view > Advanced settings > Use specific JVM Arguments
and add a new argument:
-Djava.library.path=/path/to/gdal/swig/java
?
Did you try to run the Java version of ogrinfo to check that the Java binding is running properly ?
Francois
One Star

Re: Gdal Java Binding issue on OS X

Hi, I've no mac for testing but did you also properly set "java.library.path" in job adv. settings:
Run view > Advanced settings > Use specific JVM Arguments
and add a new argument:
-Djava.library.path=/path/to/gdal/swig/java

Yes i did it
Did you try to run the Java version of ogrinfo to check that the Java binding is running properly ?

How do i "run the Java version of ogrinfo" ?
Tahnks
One Star

Re: Gdal Java Binding issue on OS X

Hi Eric,
Take a look at the "Running something" section from this page : http://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix
Mathieu
One Star

Re: Gdal Java Binding issue on OS X

Hello,
I did not compile properly in swig/java... it works now ...
Thanks for your help !!
Eric