问题
I have a simple Java project and I have to write some data to a HDF5 file. I use Netbeans under Windows. Normally, I build libraries from the respective jar-files. So much for my knowledge how to do things ;)
I downloaded and installed the binaries from the hdf5 download page. But what comes next? I had a look at HDF5-Java support page but did not get any clue what to do to integrate HDF5 in my JavaApplication.
P.S.: I found sis-jhdf5 but I did not get it running as well. I also found some older sites explaining the compilation of HDF under windows and a thread for OS_X but that did not help me either.
There are so many different pages trying to explain this matter and I somehow lost the overview. May someone help me, please? A higher level of detail in the explanation would be appreciated ;)
回答1:
If you are not obliged to use a specific Java HDF5 library, you may want to have a look at HDFql which greatly simplify how HDF5 files are handled. This tool can be used in NetBeans IDE (8.2) as follows:
Download HDFql from http://www.hdfql.com/#download and unzip it.
Open NetBeans.
Select menu option
File > New Project(a dialog titledNew Projectshould pop-up).Inside dialog
New Project:4.1. Select
Javafor the category andJava Applicationfor the project.4.2. Press button
Next.4.3. Specify a name for the project and its location.
4.4. Press button
Finish.Select menu option
Run > Set Project Configuration > Customize(a dialog titledProject Properties - ...should pop-up).Inside dialog
Project Properties - ...:6.1. On the left side of the dialog, select
Sourcesfor the category, and after:6.1.1. Press button
Add Folder...in theSource Packages Folders(a dialog titledAdd Source Foldershould pop-up):6.1.1.1. Inside dialog
Add Source Folder, select the folder where the HDFql Java wrapper was unzipped in step 1. Example:c:\hdfql-2.0.0\wrapper\java.6.2. On the left side of the dialog, select
Runfor the category, and after:6.2.1 On the
VM Optionsfield, insert-Djava.library.path=c:\hdfql-2.0.0\wrapper\java\as\hdfql.
The NetBeans project is now properly configured to use HDFql. Now, if you run the following Java program (as an example):
import as.hdfql.*;
public class Test
{
public static void main(String[] args)
{
// create an HDF5 file named "test.h5"
HDFql.execute("CREATE FILE test.h5");
}
}
An HDF5 file named test.h5 will be created in the folder where this program ran.
来源:https://stackoverflow.com/questions/49178400/how-to-use-hdf5-in-windows-java-project-with-netbeans