[gdal-dev] Using the GDAL/OGR Java bindings with the OSGeo4W environment

Even Rouault even.rouault at mines-paris.org
Sun Apr 24 14:40:11 EDT 2011


Marvin,

I think you just have to add the directory where gdaljni.dll, ogrjni.dll, 
etc.. are to your system PATH, or if you don't want to alter it, to the 
java.library.path JVM variable.

Ah, and you don't need to call System.loadLibrary("gdal18"); 
It should be loaded implicitely when the GDAL jni dlls are loaded.

Best regards,

Even

> Hi,
> 
> I have installed GDAL and GDAL for Jave with the OSGeo4W installer.
> 
> I am using an Eclipse project and have set the JRE that was installed by
> the OSGeo4W installer as the JRE to use in my project. I have also added
> the gdal.java from OSGeo4W (in the "lib" directory) to the java class
> path.
> 
> Now I'm trying to run this:
> 
> System.loadLibrary("gdal18");
> ogr.RegisterAll();
> ogr.Open(ds, 0);
> 
> where "ds" is a certain data source. Unfortunately, I am getting this
> error:
> 
> 
> 
> 
> Native library load failed.
> java.lang.UnsatisfiedLinkError: org.gdal.gdal.gdalJNI.HasThreadSupport()I
> Native library load failed.
> java.lang.UnsatisfiedLinkError: org.gdal.gdal.gdalJNI.HasThreadSupport()I
> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> org.gdal.ogr.ogrJNI.Open__SWIG_0(Ljava/lang/String;I)J
> 	at org.gdal.ogr.ogrJNI.Open__SWIG_0(Native Method)
> 	at org.gdal.ogr.ogr.Open(ogr.java:127)
> 
> 
> 
> 
> 
> Why? Can anyone help? As said, I have used the OSGeo4W installer to install
> GDAL and GDAL for Java. The installer is supposed to automatically add the
> necessary dependencies?
> 
> Thanks in advance
> Marvin
> 
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Using-the-GDAL-OGR-Java-bindings-wi
> th-the-OSGeo4W-environment-tp6301272p6301272.html Sent from the GDAL - Dev
> mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list