How to read all remote sensing images of hdf4 and hdf5

hello everybody,is there a way to use the Java API to read remote sensing images of all hdf4 and hdf5 formats?
when i use snap api to read hdf4 data,
Product product=ProductIO.readProduct(“C:\Users\26078\Desktop\GLASS09A01.V02.A2014001.h27v05.2015360.hdf”);
the eclipse reports an error:
java.lang.UnsatisfiedLinkError: no jhdf5 in java.library.path
at java.lang.ClassLoader.loadLibrary(
at java.lang.Runtime.loadLibrary0(
at java.lang.System.loadLibrary(
at ncsa.hdf.hdf5lib.H5.loadH5Lib(
at ncsa.hdf.hdf5lib.H5.(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at org.esa.snap.dataio.hdf5.Hdf5ProductWriterPlugIn.loadHdf5Lib(
at org.esa.snap.dataio.hdf5.Hdf5ProductWriterPlugIn.(
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at java.lang.Class.newInstance(
at java.util.ServiceLoader$LazyIterator.nextService(
at java.util.ServiceLoader$
at java.util.ServiceLoader$
at org.esa.snap.SnapCoreActivator.loadServices(

Is it not supported by snap API?
what should i do?
thank you for your help!

1 Like

I think the reason is that the HDF libraries are not found when you simply put the jars on your classpath.
You can use the following java properties to define the path:


You can find these libraries in lib-hdf-2.7.1.jar

hi marpet:
I try to use the desktop SNAP to open this .HDF image,however ,it doesn’t work,Doesn’t SNAP support all .hdf images? is
there a way of using java API to read all .hdf images?
THANK you for your reply!

No, not all hdf files are supported. For some files the supported might be limited and some might not open at all.
But there is a plugin point. So you could write a Plugin and extend SNAP with the capability you need.
Here you can find a little introduction:

A post was split to a new topic: How to read Cosmo-SkyMED data