Reputation: 343
I'm trying to run the GeoTools ImageLab.java exmaple. It works fine inside Eclipse and I'm using Maven as in the instructions. I'm trying to load a GeoTIFF. But when I use Eclipse to build a runnable jar file and run that from a DOS command line I get:
Jun 11, 2018 6:49:57 PM it.geosolutions.imageio.gdalframework.GDALUtilities loadGDAL
WARNING: Failed to load the GDAL native libs. This is not a problem unless you need to use the GDAL plugins: they won't be enabled.
java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.UnsupportedOperationException: Trying to get a reader from an unknown format.
at org.geotools.coverage.grid.io.UnknownFormat.getReader(UnknownFormat.java:53)
at org.geotools.tutorial.raster.ImageLab.displayLayers(ImageLab.java:103)
at org.geotools.tutorial.raster.ImageLab.getLayersAndDisplay(ImageLab.java:87)
at org.geotools.tutorial.raster.ImageLab.main(ImageLab.java:61)
The JNI reference makes me think I need a gdal dll file, but I'm having trouble finding one if that's the case.
All help appreciated! Thanks in advance.
Upvotes: 1
Views: 2612
Reputation: 10976
If you are using the gt-imageio-ext-gdal
module then you will need to make sure that the JVM can see your gdal libraries and that they are the exact version expected by the module. There are detailed instructions on how to install that on the related GeoServer page.
However, for a simple GeoTiff there is no need for GDAL as this is handled by the gt-geotiff
module.
Finally, if you are trying to build a single jar application you should make sure you have read and understood this FAQ entry.
Upvotes: 2