Le 27/11/2023 à 10:40, Raivo Rebane via gdal-dev a écrit :

Hi,

I want to use GDAL for GML parsing with Java.

I made an Eclipse project and got dependency - gdal-3.8.0.

My code compiles fine, but in debuging at line - gdal.AllRegister();

I got error :

Native library load failed.

java.lang.UnsatisfiedLinkError: no gdalalljni in java.library.path: [/home/Raivo/GML/lib]

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:712)

at My.Parser.Parser.main(Parser.java:16)

an in realility gdalalljni doesnt exist in my computer.

So I cloned GDAL sources from git, version 3.9.0, but I didn't find docs how to buil Java binding jar file

Cf https://gdal.org/development/building_from_source.html#java-bindings-options

I've just submitted in https://github.com/OSGeo/gdal/pull/8836 more detailed instructions:

"""


How to use the bindings
-----------------------

The result of the build of the Java bindings will be both a :file:`gdal.jar`
and a companion :file:`libgdalalljni.so` / :file:`libgdalalljni.dylib` /
:file:`gdalalljni.dll` native library. To limit potential compatibility problems, you should ensure that gdal.jar and gdalalljni come from the same GDAL sources.

The native gdalalljni library, as well as the core libgdal library (and its
dependencies) should be accessible through the mechanism of the operating
system to locate shared libraries.
Typically on Linux, this means that the path to those libraries should be set in the ``LD_LIBRARY_PATH`` environment variable (or in :file:`/etc/ld.so.conf`).
On MacOSX, it should be in the ``DYLD_LIBRARY_PATH`` environment variable.
And on Windows, in the ``PATH`` environment variable.

For example, to test on Linux that the bindings are working, you can lanch,
from the build directory:

::

    export LD_LIBRARY_PATH=$PWD:$PWD/swig/java:$LD_LIBRARY_PATH
    java -classpath $PWD/swig/java/gdal.jar:$PWD/swig/java/build/apps gdalinfo

On Windows:

::

    set PATH=%CD%;%CD%\swig\java;%PATH%
    java -classpath %CD%\swig\java\gdal.jar;%CD%\swig\java\build\apps gdalinfo

"""

Even

--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to