I'm new in HDF5, and I am a Java, Ubungtu-32bit 11.4, Eclipse user. But I
can't run the java intro-examples on my computer.
I have downloaded the "hdf-java-2.7-bin.tar", and extracted it. Then, I add
all the jar Files in the "haf-java -> lib" to my Project.
Then I copy the example file "H5_CreateDataset.java" into my Project, but it
doesn't work!!! The Error are:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
ncsa.hdf.hdf5lib.HDF5Constants.H5_INDEX_UNKNOWN()I
at ncsa.hdf.hdf5lib.HDF5Constants.H5_INDEX_UNKNOWN(Native Method)
at ncsa.hdf.hdf5lib.HDF5Constants.<clinit>(HDF5Constants.java:40)
at H5_CreateDataset.CreateDataset(H5_CreateDataset.java:21)
at H5_CreateDataset.main(H5_CreateDataset.java:77)
That means here is wrong:
file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);"
You need to add the HDF5 JNI library to your path.
In Eclipse, go to "Run" --> "Run Configurations...". Select the program to run and add
the path at VM arguments, e.g.
Add the path
-Djava.libary.path=G:\Projects\Java\hdf-java\native\hdf5lib
Or add the specific library
-Dncsa.hdf.hdf5lib.H5.hdf5lib=G:\Projects\Java\hdf-java\native\hdf5lib\jhdf5.dll
Thanks
--pc
···
On 5/24/2011 5:13 AM, blatoo wrote:
Hi all,
I'm new in HDF5, and I am a Java, Ubungtu-32bit 11.4, Eclipse user. But I
can't run the java intro-examples on my computer.
I have downloaded the "hdf-java-2.7-bin.tar", and extracted it. Then, I add
all the jar Files in the "haf-java -> lib" to my Project.
Then I copy the example file "H5_CreateDataset.java" into my Project, but it
doesn't work!!! The Error are:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
ncsa.hdf.hdf5lib.HDF5Constants.H5_INDEX_UNKNOWN()I
at ncsa.hdf.hdf5lib.HDF5Constants.H5_INDEX_UNKNOWN(Native Method)
at ncsa.hdf.hdf5lib.HDF5Constants.<clinit>(HDF5Constants.java:40)
at H5_CreateDataset.CreateDataset(H5_CreateDataset.java:21)
at H5_CreateDataset.main(H5_CreateDataset.java:77)
That means here is wrong:
file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);"
I think, I have already add the hdf5 library:
In Eclipse: project right click -> properties -> Java Build Path ->
Librabies -> Add External Jars -> jhdf5.jar
Actually I have added all the JarFiles:
Then, I did just like what you said:
But I still got the same Error Message. .... It's so weird...
Make sure that the .dll (for Windows) or .so (for linux) is at the
-Djava.library.path=/.....
Check your /home/.../hdf5-2.7/hdf-java/lib/$YOUR_PLATFORM folder.
Thanks
--pc
···
On 5/24/2011 9:16 AM, blatoo wrote:
Hi Peter,
I think, I have already add the hdf5 library:
In Eclipse: project right click -> properties -> Java Build Path ->
Librabies -> Add External Jars -> jhdf5.jar
I have checked the folder, then I found in the folder
"/home/fatfox/collections/java/hdf5/hdf5-2.7/hdf-java/lib/linux" there are
"libjhdf.so" and "libjhdf5.so", so I changed the Path in the VM argument.
Now it looks like this:
but the Error is still the same. It reported me always the error
"HDF5Constants.H5_INDEX_UNKNOWN() line: not available [native method]"
Shall I do some other Installatoins before I use HDF5?
I have checked the folder, then I found in the folder
"/home/fatfox/collections/java/hdf5/hdf5-2.7/hdf-java/lib/linux" there are
"libjhdf.so" and "libjhdf5.so", so I changed the Path in the VM argument.
I installed the HDFView Installer, but it still the same Error. (I did the
same setting in Eclipse like above )
I think, it may be either a bug in the latest HDF Version or the examples
online are not updated. Because, if I use the old Version HDF, the
"H5_CreateFile.java" and "H5_CreateDataset.java" do works. (But
H5_ReadWrite.java has some errors, it can't be run.)
Hii peopel..
I am facing the same problem..
it is not letting me create a file?
java.lang.UnsatisfiedLinkError: no jhdf5 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at ncsa.hdf.hdf5lib.H5.loadH5Lib(H5.java:347)
at ncsa.hdf.hdf5lib.H5.<clinit>(H5.java:274)
at ncsa.hdf.hdf5lib.HDF5Constants.<clinit>(HDF5Constants.java:28)
at ncsa.hdf.object.h5.H5File.<init>(H5File.java:186)
at ncsa.hdf.object.h5.H5File.<init>(H5File.java:123)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at ncsa.hdf.object.FileFormat.<clinit>(FileFormat.java:210)
at H5FileCreate.main(H5FileCreate.java:38)
Cannot find HDF5 FileFormat.
Hii people..
I am facing the same problem..
it is not letting me create a file?
java.lang.UnsatisfiedLinkError: no jhdf5 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at ncsa.hdf.hdf5lib.H5.loadH5Lib(H5.java:347)
at ncsa.hdf.hdf5lib.H5.<clinit>(H5.java:274)
at ncsa.hdf.hdf5lib.HDF5Constants.<clinit>(HDF5Constants.java:28)
at ncsa.hdf.object.h5.H5File.<init>(H5File.java:186)
at ncsa.hdf.object.h5.H5File.<init>(H5File.java:123)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at ncsa.hdf.object.FileFormat.<clinit>(FileFormat.java:210)
at H5FileCreate.main(H5FileCreate.java:38)
Cannot find HDF5 FileFormat.
Hii peopel..
I am facing the same problem..
it is not letting me create a file?
java.lang.UnsatisfiedLinkError: no jhdf5 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at ncsa.hdf.hdf5lib.H5.loadH5Lib(H5.java:347)
at ncsa.hdf.hdf5lib.H5.<clinit>(H5.java:274)
at ncsa.hdf.hdf5lib.HDF5Constants.<clinit>(HDF5Constants.java:28)
at ncsa.hdf.object.h5.H5File.<init>(H5File.java:186)
at ncsa.hdf.object.h5.H5File.<init>(H5File.java:123)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at ncsa.hdf.object.FileFormat.<clinit>(FileFormat.java:210)
at H5FileCreate.main(H5FileCreate.java:38)
Cannot find HDF5 FileFormat.
I had multiple issues with installation in C++ and Java, neither seem to figure.When I used the Java version I simply found the specified jar files on their website and imported them externally. Eclipse seems to possess no issue until I’m going to open the file (I have also linked the hdf5.dll), and that I received this error:
Exception in thread “main” java.lang.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’s just that I even have not properly installed the Java-hdf libraries, however, I’m unsure of the way to properly install them. I read abreast of using CMake to compile some binaries, however, when compiling CMake threw some unknown errors so I’m completely stuck. Please help with the right installation, I can provide more info if needed.
This can only possible with the help of my trainer, now I am doing an online java course: https://www.cetpainfotech.com/technology/java-training