[gdal-dev] Cannot load Java GDAL native library in web application with error in link library?

yuchan a09550 at gmail.com
Tue May 23 07:22:40 PDT 2017

for anyone has same problem as me, you can see the answer here:
for the option 2 with the change directly in code and you need to put the
gdal library folder as input.

Option 2: Add path to usr_paths
Instead of having to re-evaluate the entire java.library.path and
sun.boot.library.path as in Option 1, you can instead append your path to
the usr_paths array. This is shown in the following code:
* Adds the specified path to the java library path
* @param pathToAdd the path to add
* @throws Exception
public static void addLibraryPath(String pathToAdd) throws Exception{
    final Field usrPathsField =
    //get array of paths
    final String[] paths = (String[])usrPathsField.get(null);
    //check if the path to add is already present
    for(String path : paths) {
        if(path.equals(pathToAdd)) {
    //add the new path
    final String[] newPaths = Arrays.copyOf(paths, paths.length + 1);
    newPaths[newPaths.length-1] = pathToAdd;
    usrPathsField.set(null, newPaths);

View this message in context: http://osgeo-org.1560.x6.nabble.com/Cannot-load-Java-GDAL-native-library-in-web-application-with-error-in-link-library-tp5321448p5321471.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.

More information about the gdal-dev mailing list