I'm trying to import hdf.hdf5lib.H5 into my maven project in NetBeans. It has this as import line
import hdf.hdf5lib.H5;
as suggested here: https://support.hdfgroup.org/products/java/JNI3/jhi5/index.html
However, it throws this exception:
java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: Uncompilable source code - package hdf.hdf5lib does not exist
NetBeans already warned me about it by saying at the import line "packadge does not excist". So I let it "search dependencies at Maven repositories". It does find something and it adds this to my pom.xml:
<dependency>
<groupId>org.hdfgroup</groupId>
<artifactId>hdf-java</artifactId>
<version>2.6.1</version>
<type>jar</type>
</dependency>
Unfortunately it keeps the warning at the import line "packadge does not excist" and the error exception. It seems this addition to the pom.xml does nothing.
I am a beginner in all of this, so maybe the solution is obvious, but I cannot find it. These questions already date back to between 2012 and 2014, but didn't help me:
http://hdf-forum.184993.n3.nabble.com/maven-repository-for-java-release-td4026938.html
http://hdf-forum.184993.n3.nabble.com/HDF-Java-on-Maven-td4025772.html
add hdf5 libs (java & c++) to public maven repository?
How to use HDF5 in Windows Java project with NetBeans
Getting Started with hdf5 Java library
As suggested by ddarellis this might be a version problem. It seems there are two options.
- HDF Java 3.3.2, and HDF5-1.8.19 (HDFView Version 2.14)
- Java HDF Object Package 3.0.0, and HDF5-1.10
I'll try both, but the suggestion from maven to use HDF Java 2.6.1 is wrong.
This post was helpfull for adding jarhdf5-3.3.2.jar to the dependencies.
https://forums.netbeans.org/post-62903.html#62903
- In Maven project open "Add dependency" dialog
- Make up some groupId, artifactId and version and fill them, OK.
- Dependency will be added to the pom.xml and will appear under "Libraries" node of maven project
- Right-click Lib node and "manually install artifact", fill the path to the jar Jar should be installed to local Maven repo with coordinates entered in step 2).
Ok, so I installed HDF5 1.8.19 HDFView2.14 and added jarhdf5-3.3.2 to the dependencies. However I get this error when I try to run:
Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at hdf.hdf5lib.H5.<clinit>(H5.java:230)