-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
What is the bug?
I'm always getting the same error when I try to use gdal.AllRegister() (Java 8 in Eclipse with import org.gdal.gdal.gdal;):
Native library load failed.
java.lang.UnsatisfiedLinkError: C:\Program Files\GDAL\gdalalljni.dll: The specified procedure could not be found
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.gdal.gdal.gdalJNI.AllRegister()V
With gdal.VersionInfo(); the exception is pretty similar:
Native library load failed.
java.lang.UnsatisfiedLinkError: C:\Program Files\GDAL\gdalalljni.dll: The specified procedure could not be found
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.gdal.gdal.gdalJNI.VersionInfo__SWIG_1()Ljava/lang/String;
I followed the install guide here (didn't install filegdb because I don't need it), which was working fine on Win 10 but now on Win 11 I can't get it to work again:
- Install the "...core.msi" file ("generic installer")
- Create the
GDAL_DATA,GDAL_DRIVER_PATHandPROJ_LIBenvironment variables - Add
C:\Program Files\GDALandC:\Program Files\GDAL\javato PATH - Download the .zip for the compiled binaries and copy the
gdalalljni.dllfile intoC:\Program Files\GDAL\java - Add the "gdal-x-x-x.jar" from the same zip to my project (copy to a new "lib" folder, then add add them in the build path)
The .dll does exist in this folder (actually, both directly in "GDAL" and in "GDAL\java") but for some reason it still can't find it!
What I've tried to far:
- Both the latest GDAL version (3.12.1, downloaded yesterday) and the old version (3.11.1, which was working on Win 10)
- Added a VM argument for this JRE, as suggested in a forum and on the geoserver website ("Note on running GeoServer as a Service on Windows"):
-Djava.library.path="C:\Program Files\GDAL;${env_var:PATH}") - Installed the latest MSVC++ redistributable (link)
- Copied the .dll file into the "lib" folder that already contains the .jar, then set the folder as "native library location" (Project - Properties - Java Build Path - Source)
- Exported it as a .jar file and run it with a .bat file (same error, so it looks like it's not even a problem with Eclipse)
- Run the .jar from regular command prompt (run as admin)
- Set full access permissions for the GDAL folder for my specific Windows admin user
None of this worked, I keep getting the same error.
Steps to reproduce the issue
Install the GDAL as described above and run gdal.AllRegister().
Versions and provenance
Win 11, tested with GDAL 3.12.1 and 3.11.1
I downloaded the files for MSVC 2019 x64 from the gisinternals website.
Additional context
No response