user2896438
user2896438

Reputation: 944

Java hdf5 library install

Note: This is my first stack overflow question, if it is terrible forgive me.

For a school project I have been trying to access the Million Song Dataset. I have had multiple issues with installation in C++ and Java, neither seem to work. With the Java version I simply found the required jar files on their website and imported them externally. Eclipse seems to have no issue until I go to open the file (I have also linked the hdf5.dll), and I receive this error:

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class ncsa.hdf.hdf5lib.HDF5Constants at ncsa.hdf.object.h5.H5File.(H5File.java:98) at ncsa.hdf.object.h5.H5File.(H5File.java:143) at hdf5_getters.hdf5_open_readonly(hdf5_getters.java:52) at hdf5_getters.main(hdf5_getters.java:564) at Main.main(Main.java:7)

I really think it is just that I have not properly installed the Java-hdf libraries, however I am unsure of how to properly install them. I read up on using CMake to compile some binaries, however when compiling CMake threw some unknown errors so I am completely stuck. Please help with the proper installation, I can provide more info if needed.

This is the source for the getters required to retrieve song fields stored in the database: https://github.com/tbertinmahieux/MSongsDB

This is the instructions I attempted to follow, then eventually found and downlaoded the appropriate .jar files and just imported as external jar in eclipse: https://www.hdfgroup.org/products/java/release/downloadsrc.html#src

Upvotes: 0

Views: 3021

Answers (2)

Dang
Dang

Reputation: 1

As for MAC user, copy the libjhdf5.jnilib to /Library/Java/Extensions may solve the problem.

You should find the lib here.

Reference is here.

Upvotes: 0

user2896438
user2896438

Reputation: 944

This is the solution to any related issues accessing this dataset with the guy's implementation. Unfortunately it was coded back in 2010/2011 and his implementation only works for java-hdf around that time. It took me forever to figure this out and find the old library, as well as a .dll that matched up. Hope this saves someone a day or two....

Jar: http://www.java2s.com/Code/Jar/h/Downloadhdfjava261jar.htm

DLL: ftp://ftp.hdfgroup.org/HDF5/releases/HDF-JAVA/HDF-JAVA-2.8/bin/win64/hdf-java/lib/win/jhdf5.dll

Also, you must link the dll by (in eclipse) going to run->run configurations -> arguments and in the VM box type this: -Dncsa.hdf.hdf5lib.H5.hdf5lib="PATH_TO_DLL" where "PATH_TO_DLL" is replaced by the full path to the dll. i.e. for me: -Dncsa.hdf.hdf5lib.H5.hdf5lib=C:\Users\pete\Desktop\HDF5\jhdf5.dll

Whatever you do do NOT attempt to follow the hdf5 install instructions for java on their website, it will not work for this implementation and you will waste many hours. Neither will any of the C++ getter implementations or Python implementations without an extensive collection of outdated libraries that are not only hard to find, but impossible to match with the date stamp. (all of this applies only to the implementation of Million Song Database getters written by tbertin)

Upvotes: 1

Related Questions