mardi 31 mars 2015

Environment variable issue with gdal java under Windows 7

I built gdal and java bindings for gdal. My environment variables I added (Windows 7 64 bit):



CLASSPATH = C:\Program Files\Java\JDK1.8.0_40\lib; C:\gdal-1.11.1\swig\java\gdal.jar


the dlls (gdal111.dll (I run version 1.11.1), gdaljni.dll, ogrjni.dll and gdalconsthni.dll) are in the same folder as gdal.jar



GDAL_DATA = C:\gdal-1.11.1\data


That is the file where compdcs.csv etc. are.



JAVA_HOME = C:\Program Files\Java\jdk1.8.0_40;

Path = C:\gdal-1.11.1\bin; C:\Program Files\Java\jdk1.8.0_40\bin;C:\ProgramData\Oracle\Java\javapath;


In C:\gdal-1.11.1\bin is gdal_contour.exe, gdal111.dll etc.


Anything suspicious so far? When I use gdal.Allregister(); in MyClass.class I get the



java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.gdal.gdal.gdalJNI.AllRegister()V
...


and now comes the interesting part: When I copy gdal.jar, gdal111.dll (I run version 1.11.1), gdaljni.dll, ogrjni.dll and gdalconsthni.dll in to the same folder as MyClass.class and run java MyClass it works.


And in Eclipse I have to put them into the bin file.. What is going on?


Oh and I should mention, that I have Windows 7 64 bit I think that I miss the link between MyClass.class and the environment variables


Aucun commentaire:

Enregistrer un commentaire