1. Use the compiled installation Jdal
http://www.gisinternals.com/release.php
gdal-111-1800-x64-core.msi:http://download.gisinternals.com/sdk/downloads/ Release-1800-x64-gdal-1-11-3-mapserver-6-4-2/gdal-111-1800-x64-core.msi
2. Configure Maven
Pom.xml
<Dependency> <groupId>Org.gdal</groupId> <Artifactid>Gdal</Artifactid> <version>1.11.2</version></Dependency>
3. Configure Environment variables
gdal_bin=C:\Program files\gdal gdal_data=c:\program files\gdal\gdal-DATA gdal_driver=c:\ Program Files\gdal\gdalplugins
4. Questions
Nativelibraryloadfailed.java.lang.UnsatisfiedLinkError:noogrjniinjava.library.pathExceptioninthread "Main" Java.lang.UnsatisfiedLinkError:RegisterAllatorg.gdal.ogr.ogrJNI.RegisterAll (Nativemethod) Atorg.gdal.ogr.ogr.RegisterAll (ogr.java:115) atcom.gdal.vector.ShapeFileWrite.main (shapefilewrite.java:20)
Method 1,Place the DLL file directly under the Java Engineering root directory. GDAL Java Demo compiled successfully. Advantages: Simple thinking, 32, 64-bit DLL can be very convenient to switch. Disadvantage: Each new project needs to copy these DLLs, increase the project file size, cumbersome operation.
Method 2, setSystem environment variables Specify the DLL path, add it to the path in the operating system to run a program (command), if you do not specify an absolute path, it will go to the program itself is located under the path to find the executable file, when the file is not found, will go to the environment variable path below to find what you need. So we just need to add the path of this gdal DLL to path, right-click Computer--"Properties--" Advanced system settings--"Environment variables-" New system variables: New two system variables Gdal32_dll variable name: Gdal32_dll variable value: \ C Gdal\release-1600-win32-dev\release-1600\bin; The C:\GDAL\release-1600-win32-dev\release-1600\bin\gdal\java name can be defined by itself, specifying the GDAL DLL path location, and the GDAL Java version of the compiled path. Increase in front of path (if no path system variable is created) "%gdal32_dll%;", that is, path becomes%gdal32_dll%;%java_home%/... Note: After you add a DLL to path, you need to restart your computer, or log off and enter the Windows system before it takes effect.
Java maven Installation Gdal