hdf5 Java库入门 [英] Getting Started with hdf5 Java library
问题描述
我正在用jhdf5学习HDF5。
I am learning HDF5 with jhdf5.
我正在研究MAC OS_X。
I am working on MAC OS_X.
- brew install hdf5
此安装hdf5-1.10 in / usr / local / Cellar / hdf5
This installs hdf5-1.10 in /usr/local/Cellar/hdf5
- 复制此文件并将其放入gradle项目中。
https://support.hdfgroup.org/ftp/HDF5/hdf-java/hdf-java-examples/jnative/h5/HDF5FileCreate.java
这是最基本的java示例文件。
This is the most basic java example file.
-
在gradle中添加此依赖项
Add this dependency in gradle
编译组:'org.hdfgroup',名称:'hdf-java',版本:'2.6.1'
compile group: 'org.hdfgroup', name: 'hdf-java', version: '2.6.1'
通过添加<$更新包导入语句c $ c> ncsa 在前面。
运行它。我收到此错误 java.lang.UnsatisfiedLinkError:java.library.path中没有jhdf5
Run it. And I got this error java.lang.UnsatisfiedLinkError: no jhdf5 in java.library.path
这是预期的,因为根据我的知识, jhdf5
只是一个调用本机函数的包装器。
This is expected because jhdf5
according to my knowledge is just a wrapper calling native functions.
所以我需要在系统设置中添加一些东西给 ncsa.hdf.hdf5lib.H5.hdf5lib
。
So I need to add something to ncsa.hdf.hdf5lib.H5.hdf5lib
in the system setting.
我不确定要添加哪个库以及在哪里找到它们。
我在网上找到了一些例子,但都是在Windows中,因此名称和路径并不相似。
I found a few examples online but all are in Windows, hence, the names are and paths are not really similar.
推荐答案
尝试几次后我发现了它。
I found it after trying a few times.
-
转到 https://support.hdfgroup.org/products/java/release/cmakebuild.html 并安装CMake-hdfjava-。
Go to https://support.hdfgroup.org/products/java/release/cmakebuild.html and install CMake-hdfjava-.
注意:如果以前没有安装,可能需要安装CMake。
NOTE: might need to install CMake if it is not done before.
安装后(通过运行脚本),转到构建目录。解压缩网页中提到的zip文件。
After installing it (by running the script), go to build directory. Unzip the zip file mentioned in the webpage.
在IDE中运行java文件时添加此文件,例如:
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
或者,我们也可以使用网页中提供的shell脚本来运行。
Alternatively, we can also use the shell script provided in the web page to run too.
这篇关于hdf5 Java库入门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!