Hi,
I’m using HDF5 in C++ and Python projects and my plan is to also switch to HDF in Java. In Python and C++, I spend about 30 minutes making the code work without any prior knowledge. In Java, however, I’ve already spent several hours, and the effort has been fruitless. So my question is: What Java wrapper is tested on Windows? Preferably prebuilt, but not necessarily.
I’ve already tested:
List item JHDF: works, but the dataset size limit is prohibitive for my application
I do not want to investigate/debug the individual wrappers in this thread. Rather, I’m seeking advice on which wrapper I should focus on cause I do not have the energy to debug multiple Java wrappers simultaneously.
Do you have any experience about which of the Java wrappers is reliable and works on Windows?
Would you mind to post the code that you used to test HDFql in Java?
That said, HDFql could be a good candidate for your use-case given that it supports all the programming languages you mentioned (namely: C++, Python and Java).
We test the Java wrappers in the official release on a number of platforms, on Windows you do need to set the “PATH” to all the dlls in the stack (hdf_java.dll, hdf5.dll) and the interface is through the jarhdf5-1.14.3,jar file.
In the HDF5examples code here is one of the test command lines:
– COMMAND: /usr/bin/java; -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=info -Djava.library.path="/HDF_Group/HDF5/1.14.3/lib" -cp ".:/HDF_Group/HDF5/1.14.3/lib/jarhdf5-1.14.3.jar:/HDF_Group/HDF5/1.14.3/lib/slf4j-api-2.0.6.jar:/HDF_Group/HDF5/1.14.3/lib/slf4j-nop-2.0.6.jar:/hdf5-examples/JAVA/H5G/exJ_H5Ex_G_Create.jar" ;-Dhdf.hdf5lib.H5.loadLibraryName=hdf5::hdf5_java; H5Ex_G_Create
Blockquote on Windows you do need to set the “PATH” to all the dlls in the stack (hdf_java.dll, hdf5.dll) and the interface is through the jarhdf5-1.14.3,jar file.
I did exactly that, setting the library path to bin folder where both dlls are located and including the jar as a maven dependency. However, there is clearly some problem in the library loading process.
Regarding your suggested test command, there are no jars in the examples folder (/hdf5-examples/JAVA/H5G/exJ_H5Ex_G_Create.jar does not exist). Do I need to build and package the examples first?
I figured you had the path set correctly, just stated the obvious for future folks that happen upon this post. ;{)
Right that command was pulled from a build of the examples. (and edited out extra path info)
The important items are the classpath and library options to the java command. (one variation, there are other methods that may be more suitable). The slfj jars may not be needed.
Does the linux shellscript, junit.sh.in in the /java/test folder help any (around line 300 and the actual command line around 346)?
It has been awhile since I had been working at this level and with your (and others) help maybe I could get a howto use hdf5 java wrappers document in the repo.
Well, I can try to replicate the command and see if it works, but there are some placeholders in the shell script (@H5_JAVAFLAGS@), and I do not know how to get values for them, as I’ve never used such a setup (customizing shell scripts by values provided by build system)
Here is a command line (edited to shorten paths) from a recent build; C:/jdk-19.0.2/bin/java.exe -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=info -Djava.library.path="C:/bin/RelWithDebInfo" -cp ".;C:/lib/junit.jar;C:/lib/hamcrest-core.jar;C:/lib/jarhdf5-1.15.0.jar;C:/lib/slf4j-api-2.0.6.jar;C:/lib/ext/slf4j-simple-2.0.6.jar;C:/test/jartest5_TestH5D.jar" -Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java;-ea;org.junit.runner.JUnitCore test.TestH5D
The problem of the example command is that I do not have the jartest5_TestH5D.jar file. It is not in the precompiled release package, and I was not able to build the project (some LINK error, probably SZIP, but the cmake setup & build documentation is too long to efficiently identify the problem).