GDAL for Java on Windows, native library error
I know it's probably fairly simple, but I'm having some issues grasping
all the different packages I need just to install GDAL and read
georeferenced rasters.
So I have already had OSGEO4W installed so that there exists a folderpath
as follows: C:\OsGeo4W\lib\gdal.jar as well as
C:\OsGeo4W\apps\swigwin\swig.exe
I also have the version from http://vbkto.dyndns.org/sdk/ so that I have a
folderpath as follows: C:\ProjectsJava\gdal\bin\gdal\java\ with a gdal.jar
and a bunch of dll's. This is what is originally linked in my project's
libraries.
After googling the problem, I've also added a -Djava.library.path to point
to the above gdal folderpath in the project's VM options (not entirely
sure what I did but didn't make a difference anyways).
Also from random googled answers I've added environment variables to
windows point to this and that related to GDAL or SWIG that did nothing
(so removed them for now). So I only have a PATH that points to the
gdal/bin folder and a GDAL_DATA that points to the gdal/bin/gdal-data
folder. If it makes any difference I have installed successfully GDAL
bindings for Python and there are some of it's environment variables left
over in PATH and GDAL_DATA as well to similar but different folders.
Basically the code fails to even run a gdal.Open(in_path), giving the
following error which hasn't changed no matter what I did differently:
Native library load failed.
java.lang.UnsatisfiedLinkError:
C:\ProjectsJava\gdal\bin\gdal\jave\gdaljni.dll: Can't find dependent
libraries
java.lang.UnsatisfiedLinkError:
org.gdal.gdal.gdalJNI.Open__SWIG_1(Ljava/lang/String;)J'
at org.gdal.gdal.gdalJNI.Open__SWIG_1(Native Method)
at org.gdal.gdal.gdal.Open(gdal.java:563)
at ...
Now I know I probably screwed up getting GDAL right, but to be honest the
labyrinthical instructions lost me well early on. All the odd packages to
adapt C++ code to Java and instructions meant for Unix/Linux have got me
all mixed up now.
No comments:
Post a Comment