Getting Started with hdf5 Java library

淺唱寂寞╮ 提交于 2019-12-20 02:11:30

问题


I am learning HDF5 with jhdf5.

I am working on MAC OS_X.

  1. brew install hdf5

This installs hdf5-1.10 in /usr/local/Cellar/hdf5

  1. 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.

  1. Add this dependency in gradle

    compile group: 'org.hdfgroup', name: 'hdf-java', version: '2.6.1'

  2. Update package import statements by adding ncsa in front.

  3. 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.

  1. 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.

  2. After installing it (by running the script), go to build directory. Unzip the zip file mentioned in the webpage.

  3. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!