问题
I am learning HDF5 with jhdf5.
I am working on MAC OS_X.
- brew install hdf5
This installs hdf5-1.10 in /usr/local/Cellar/hdf5
- Copy this file and put it in gradle project.
https://support.hdfgroup.org/ftp/HDF5/hdf-java/hdf-java-examples/jnative/h5/HDF5FileCreate.java
This is the most basic java example file.
Add this dependency in gradle
compile group: 'org.hdfgroup', name: 'hdf-java', version: '2.6.1'
Update package import statements by adding
ncsa
in front.Run it. And I got this error
java.lang.UnsatisfiedLinkError: no jhdf5 in java.library.path
This is expected because jhdf5
according to my knowledge is just a wrapper calling native functions.
So I need to add something to ncsa.hdf.hdf5lib.H5.hdf5lib
in the system setting.
I am not sure which library to add and where to find them.
I found a few examples online but all are in Windows, hence, the names are and paths are not really similar.
回答1:
I found it after trying a few times.
Go to https://support.hdfgroup.org/products/java/release/cmakebuild.html and install CMake-hdfjava-.
NOTE: might need to install CMake if it is not done before.
After installing it (by running the script), go to build directory. Unzip the zip file mentioned in the webpage.
add this when running the java file from IDEs, example:
-Djava.library.path=/Users/wphyo/Projects/LSMD/CMake-hdfjava-3.3.2/build/HDFJava-3.3.2-Darwin/HDF_Group/HDFJava/3.3.2/lib
Alternatively, we can also use the shell script provided in the web page to run too.
来源:https://stackoverflow.com/questions/46374616/getting-started-with-hdf5-java-library