[gdal-dev] GDAL bindings support for Java 17

Even Rouault even.rouault at spatialys.com
Tue Jan 3 12:03:49 PST 2023


Adam,

I cannot help with Mac specificities, but on Ubuntu 20.04, after "sudo 
apt install openjdk-17-jdk openjdk-17-jre", the GDAL Java bindings build 
work just fine and the Java tests run with "ctest -R java" as well.

Even

Le 03/01/2023 à 18:33, adamgutonski via gdal-dev a écrit :
> Hello,
>
> My question is, is it possible to build the GDAL bindings for Java 
> 17?  I am trying to build GDAL with Java bindings for Java 
> temurin-17.jdk when prior I have been able to build and use the 
> bindings successfully for Java adoptopenjdk-8.jdk, using the exact 
> same build process.  However when I run the equivalent build steps 
> with Java 17 I continue to receive this link error when implementing 
> the bindings:
>
> *Native library load failed.*
> *java.lang.UnsatisfiedLinkError: no gdalalljni in java.library.path:* ...
> Exception in thread "main" java.lang.UnsatisfiedLinkError: 'void 
> org.gdal.gdal.gdalJNI.AllRegister()'
> at org.gdal.gdal.gdalJNI.AllRegister(Native Method)
> at org.gdal.gdal.gdal.AllRegister(gdal.java:664)
> at Main.main(Main.java:14)
>
> My system specs:
>
> System Version: macOS 12.6.1 (21G217)
>
> Kernel Version: Darwin 21.6.0
>
> Boot Volume: Macintosh HD
>
> Boot Mode: Normal
>
> Secure Virtual Memory: Enabled
>
> System Integrity Protection: Enabled
>
> Time since boot: 15 days 20:17
>
> Model Name: MacBook Pro
>
> Model Identifier: MacBookPro18,3
>
> Chip: Apple M1 Pro
>
>
> When I run the build I see that the Java bindings are generated, the 
> .jar and libgdalalljni.dylib are created in /build/swig/java. Here are 
> the build commands used:
>
> sudo arch -x86_64 /usr/local/homebrew/bin/cmake .. 
> -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/bin 
> -DBUILD_JAVA_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF 
> -DCMAKE_OSX_ARCHITECTURES=x86_64 -DGDAL_USE_ZSTD=OFF
>
>
> sudo arch -x86_64 /usr/local/homebrew/bin/cmake --build .
>
>
> sudo arch -x86_64 /usr/local/homebrew/bin/cmake --build . --target install
>
>
> Again, all of the above steps work when I am using JDK 8.  So does 
> GDAL support Java bindings for JDK 17?  Is there a way to resolve the 
> error *no gdalalljni in java.library.path? *Here are the path settings 
> in IntelliJ IDE:
> *
> *
> *VM options: 
> -Djava.library.path=/Users/<username>/code/gdal-<version>/build/swig/java:$PATH$ 
> Environment Vars: 
> PATH=/Users/<username>/code/gdal-<version>:/Users/<username>/code/gdal-<version>/build/swig/java:$PATH$ 
> *
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230103/bc1c751e/attachment.htm>


More information about the gdal-dev mailing list