Discussion:
[gdal-dev] GDAL Java Bindings - Unable to use same jar on linux and windows
johie
2016-01-05 14:33:49 UTC
Permalink
Hi everyone,

I have a problem with the GDAL 2.1.0 DEV version. I'm developing an
application, which uses GDAL Java Bindings. I have been doing development
with windows, and been using the gisinternals GDAL binaries
(http://download.gisinternals.com/sdk/downloads/release-1800-x64-gdal-mapserver.zip),
from 18 december 2015.

The problem is that I need to run the application with Centos 7 (OpenJDK
Java 8, SWIG 2.0.10), and there are no ready Java bindings (at least I have
not found). I downloaded the latest trunk from git (around same time when
installed the windows binaries, 20.12.2015), and build the gdal and swig
bindings succesfully. The problem seems to be somewhat different filenaming
inside the jar files.

If I run my application inside windows using the centos made .jar, I get:
java.lang.UnsatisfiedLinkError: org.gdal.gdal.gdalJNI.Dataset_SWIGUpcast(J)J
at org.gdal.gdal.gdalJNI.Dataset_SWIGUpcast(Native Method)

If I run it on centos, with windows made .jar I get,

Exception in thread "main" java.lang.UnsatisfiedLinkError:
org.gdal.gdal.gdalJNI.SWIGDatasetUpcast(J)J
at org.gdal.gdal.gdalJNI.SWIGDatasetUpcast(Native Method).

The only difference I can notice between them, is the name of those
methods/classes.

Any ideas how could I solve this problem? I would like to continue
developing with windows and then just move the shaded jar to the centos. I
did not have this problem when using the stable 2.0 version, however I need
some functionalities of the development version :)

Thanks a lot,

Jesse







--
View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-GDAL-Java-Bindings-Unable-to-use-same-jar-on-linux-and-windows-tp5243795.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
Even Rouault
2016-01-05 14:59:49 UTC
Permalink
Post by johie
Hi everyone,
I have a problem with the GDAL 2.1.0 DEV version. I'm developing an
application, which uses GDAL Java Bindings. I have been doing development
with windows, and been using the gisinternals GDAL binaries
(http://download.gisinternals.com/sdk/downloads/release-1800-x64-gdal-mapse
rver.zip), from 18 december 2015.
The problem is that I need to run the application with Centos 7 (OpenJDK
Java 8, SWIG 2.0.10), and there are no ready Java bindings (at least I have
not found). I downloaded the latest trunk from git (around same time when
installed the windows binaries, 20.12.2015), and build the gdal and swig
bindings succesfully. The problem seems to be somewhat different filenaming
inside the jar files.
org.gdal.gdal.gdalJNI.Dataset_SWIGUpcast(J)J at
org.gdal.gdal.gdalJNI.Dataset_SWIGUpcast(Native Method)
If I run it on centos, with windows made .jar I get,
org.gdal.gdal.gdalJNI.SWIGDatasetUpcast(J)J
at org.gdal.gdal.gdalJNI.SWIGDatasetUpcast(Native Method).
The only difference I can notice between them, is the name of those
methods/classes.
Any ideas how could I solve this problem? I would like to continue
developing with windows and then just move the shaded jar to the centos. I
did not have this problem when using the stable 2.0 version, however I need
some functionalities of the development version :)
The issue comes from different SWIG version being used to generate the .java
bindings file

GISInternals must used SWIG 1.3.40 (SWIGDatasetUpcast) whereas CentOS 7 with
SWIG 2.0.10 generates Dataset_SWIGUpcast.
If you want to have GISInternals as a reference, then you could try to use
swig 1.3.40 on your CentOS too:
- download swig 1.3.40
- ./configure --prefix=$HOME/install-swig-1.3.40
- make && make install
- and then when building the GDAL Java bindings make sure $HOME/install-
swig-1.3.40/bin is in the front of the $PATH. Or edit gdal/swig/SWIGmake.base
so that the SWIG variable points to $HOME/install-swig-1.3.40/bin/swig
Post by johie
Thanks a lot,
Jesse
--
http://osgeo-org.1560.x6.nabble.com/gdal-dev-GDAL-Java-Bindings-Unable-to-
use-same-jar-on-linux-and-windows-tp5243795.html Sent from the GDAL - Dev
mailing list archive at Nabble.com.
_______________________________________________
gdal-dev mailing list
http://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Spatialys - Geospatial professional services
http://www.spatialys.com
Loading...