Problems with java classpath and hdf5 when running Snappy examples


I’m trying to run one of Snappy (Snap Python Bridge) examples, on images provided within the same folder (.snap/snap-python/snappy). The issue I’m encountering regard the java classpath and the hdf5 driver java library.

Here is the command I entered to run the python snap example and the warning I’m getting:
Even though the script works, and the ouput png file is created, I cannot understand why I get this warning if the java hdf5 library is there.

Please note that:

  • The java jre was not installed before the installation of snap, and as a result has been installed inside snap/jre folder.

  • Adding the java path to shell path doesn’t resolve this issue:

    export PATH=$PATH:$JAVA_HOME/bin

  • The hdf5 java driver exists:

    ~/snap $ find . -name hdf5


Hi hakim, just tested the same with SNAP 2 beta 6 on a Windows 10 without problems. Which OS are you on?

May I ask you for some more guidance here to reproduce whats going wrong. Please have a look into snappy/snappy.ini. This is the config file for snappy. Set debug:True and run again. Could you cut, paste and send the output please. Thanks!

It seems that the JVM’s “java.library.path” setting is not correctly computed from your SNAP installation directory. See snappy/, line 177.

Hi Forman,
Thanks for your answer.

I’m on Ubuntu 14.04 (Trusty).

I got the same warning with debug: True in snappy/snappy.ini:

I couldn’t guess when snappy/ is called (tried logging to a file there, it’s not called).

However, from your it seems that snappy is operational!
The actual error comes from the fact that the variable ‘b7’ has the value None.

The sample code has been written for an ENVISAT MERIS L1b test product and you are calling it with a Sentinel-2 L1C product. Please adjust the band names in the Python code and you should be fine.

The HDF5 error is an issue that we’ll fix but it is not your problem anymore, just ignore the error message for time being.

– Norman

1 Like

set path=C:\Program Files\Java\jdk1.7.0\bin

Using wildcards in java classpath

Wild cards were introduced from Java 6. Class path entries can contain the basename wildcard character *, which is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR. For ex. a classpath entry consisting simply of * expands to a list of all the jar files in the current directory.

java -cp “lib/*” %MAINCLASS%

More about…Java Classpath