Does anyone know a quick way to use GDAL Java Bindings in Java Eclipse?

It should be GDAL > 2.0.0 in order to support KEA datatypes. GDAL-Java from OSGEO4W seems to be obsolete.

I am working on Windows 10 on a 64Bit processor and Eclipse Mars.

1 Answer 1


Setting up GDAL for Java IDE (in Windows) requires the following two steps:

Setting GDAL in system/server using the following steps.

  • You can download the executable GDAL packages (stable releases) from GIS internals. Choose compiler (Microsoft Visual C) & architecture (32bit or 64bit) depending upon your PC and download the compiled binaries zip file (not the Compiled libraries and headers).

  • Extract the zip file and save in some drive preferably C drive.

  • Now create/append the following data in your PC Environmental Variables (Computer --> Properties -->Advance System Settings -->Environment variables):

    CREATE/APPEND        VARIABLE                   VALUE                              REQUIREMENT

       CREATE                         GDAL_DATA                  C:\gdal\bin\gdal-data          MANDATORY        CREATE                         GDAL_DRIVER_PATH  C:\gdal\bin\gdal\plugins      MANDATORY        APPEND                         PATH                             C:\gdal\bin                           MANDATORY        APPEND                         PATH                             C:\gdal\bin\gdal\apps          OPTIONAL

  • The last append option is required if you want to use the gdal tools from any location in your PC.
  • Now you test the GDAL tools. Open Command prompt in your PC and type gdalinfo --formats. This command will list out the typr of raster formats it supports. Alternatively ogrinfo --formats will display vector formats.

Setting GDAL for project in Netbeans/Eclipse IDE.

  • Copy and paste following four/one dll file(s) from C:\gdal\bin\gdal\java to your jdk bin folder.



    gdalalljni.dll (in higher versions of gdal v2.3.0 and above)    
  • You need to add gdal.jar file (from C:\gdal\bin\gdal\java) in the JAVA BUILD PATH Library location.

  • Now your java project will work with GDAL. Just ensure the GDAL package and JDK architecture (x86/x64).

Note: If you forget to do this you get an exception while executing your code as Exception in thread "main" java.lang.UnsatisfiedLinkError.

Note: For more information on gdal java projects, visit GeoSpatial Blogs

  • I wasn't able to run gdalinfo --formats from cmd, possibly because it's called gdalinfo.exe? When I ran that I got an error saying "The code execution cannot proceed because LIBPQ.dll was not found. Reinstalling the program may fix this problem", and the same error again for SSLEAY32.dll and LEBEAY32.dll. I chose the 64-bit version though.
    – Conan
    Commented Oct 1, 2019 at 15:58
  • 1
    @Conan you can search in C drive which folder has this DLLs. Then you can add that folder location in path environmental variable. I hope this should work. Commented Oct 1, 2019 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.