1

I downloaded Gdal release-1928-x64-gdal-3-2-1-mapserver-7-6-2-libs.zip and decompressed it to C:\Program Files\Gdal_321.
I tried to get help from gdal-dev for three weeks now, but without any luck.

I allways get the message:
Native library load failed.
java.lang.UnsatisfiedLinkError: C:\Program Files\java-1.8.0-openjdk-1.8.0.201-1.b09.ojdkbuild.windows.x86_64\jre\bin\gdalalljni.dll: The specified procedure cannot be found
when I try to execute System.loadLibrary("gdalalljni")

Setup:
Windows 10 64-bit with x64 based processor
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 13, GenuineIntel
PROCESSOR_LEVEL=6
The Java I’m using is: java-1.8.0-openjdk-1.8.0.201-1.b09.ojdkbuild.windows.x86_64
Installed release-1928-x64-gdal-3-2-1-mapserver-7-6-2-libs.zip in C:\Program Files\Gdal_321

Then I copied the gdalalljni.dll to C:\Program Files\java-1.8.0-openjdk-1.8.0.201-1.b09.ojdkbuild.windows.x86_64\jre\bin
Added the following to the system path:
C:\Program Files\java-1.8.0-openjdk-1.8.0.201-1.b09.ojdkbuild.windows.x86_64\jdk-8.0.262.10-hotspot\jre\bin
C:\Program Files\Gdal_321\bin\gdal\java
C:\Program Files\Gdal_321\bin
C:\Program Files\Gdal_321
C:\Program Files\Gdal_321\bin\gdal\apps
C:\Program Files\Gdal_321\bin\gdal\python\osgeo
C:\Program Files\Gdal_321\bin\proj7\apps
C:\Program Files\Gdal_321\bin\ms\apps
C:\Program Files\Gdal_321\bin\gdal\csharp
C:\Program Files\Gdal_321\bin\curl

Added the following system variables:
GDAL_DATA=C:\Program Files\Gdal_321\bin\gdal-data
GDAL_DRIVER_PATH=C:\Program Files\Gdal_321\bin\gdal\plugins;C:\Program Files\Gdal_321\bin\gdal\plugins-external;C:\Program Files\Gdal_321\bin\gdal\plugins-optional
JAVA_HOME=C:\Program Files\java-1.8.0-openjdk-1.8.0.201-1.b09.ojdkbuild.windows.x86_64\jre
PROJ_LIB=C:\Program Files\Gdal_321\bin\proj7\share

Then I added C:\Program Files\Gdal_321\bin\gdal\java\gdal.jar to my class-path

When I’m executing the program I get:
Native library load failed.
java.lang.UnsatisfiedLinkError: C:\Program Files\OpenJDK\jdk-8.0.262.10-hotspot\jre\bin\gdalalljni.dll: The specified procedure cannot be found

Then I’ve installed dependency Walker 22_x64.
I don’t know how to use it, but when I load gdalalljni.dll I get the following errorcodes:
See dependecy

Paul
  • 123
  • 5

2 Answers2

0

Method loadLibrary, in class java.lang.System searches the list of directories that is the value of [System] property java.library.path which is, by default, set to the value of the PATH environment variable.

Either change the value of PATH or explicitly set java.library.path when you launch your java program (using the -D option) or use method load (instead of loadLibrary) and supply the full path to file gdalalljni.dll.

Refer to How to influence search path of System.loadLibrary() through Java code?

Abra
  • 19,142
  • 7
  • 29
  • 41
  • Thanks, I itried to set the environment path to where I have gdalalljni.dll but there was no difference. – Paul Apr 01 '21 at 13:12
  • @Paul print out the value of `java.library.path` (System property) to see if the path to the directory containing file `gdalalljni.dll` appears. Also, are you certain that the name of the library is `gdalalljni`? – Abra Apr 01 '21 at 13:16
  • I'm a bit confused, there are two pathes to different java lib when I print the java.libray path: C:/Users/rty/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_14.0.2.v20200815-0932/jre/bin/server; C:/Users/rty/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_14.0.2.v20200815-0932/jre/bin; C:\Program Files\OpenJDK\jdk-8.0.262.10-hotspot\jre\bin\ The last one I've set and there is where gdalalljni.dll is placed. Yes gdalalljni.dll is the name. – Paul Apr 05 '21 at 15:58
0

I mixed upp the gdalalljni.dll and gdal305.dll I copied to my Java\bin with a gdalalljni.dll resp gdal305.dll from a nother gdal release.

Paul
  • 123
  • 5