Hey Viv, This is possible but you need to bake somewhere into your code where you load the .so shared lib from. See http://oodt.jpl.nasa.gov/repo/projects/co2/ for Rishi Verma's example of doing this.
My honest suggestion: use Apache Tika, which in turn wraps the NetCDF4-Java library which requires no *.SOs like the HDF5 Java lib does. If Tika doesn't extra all the info for you, improve Tika and gain merit in the community there :) Backup solution: use NetCDF4-Java directly. I published it for UCAR/NCAR to Maven Central since 4.2-min, so it's available for use there. Let me know if you need more help. Cheers, Chris P.S. CC'ed Apache OODT Dev list so others can contribute to the convo. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Chris Mattmann, Ph.D. Senior Computer Scientist NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA Office: 171-266B, Mailstop: 171-246 Email: chris.a.mattm...@nasa.gov WWW: http://sunset.usc.edu/~mattmann/ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Adjunct Assistant Professor, Computer Science Department University of Southern California, Los Angeles, CA 90089 USA ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -----Original Message----- From: <Tang>, "Vivian (398K)" <vivian.t...@jpl.nasa.gov> Date: Saturday, May 11, 2013 12:08 PM To: jpluser <chris.a.mattm...@jpl.nasa.gov> Cc: "Tang, Vivian (398K)" <vivian.t...@jpl.nasa.gov> Subject: Maven dynamic libraries? >Hi Chris, > >I'm writing a SMAP metadata extractor that needs to extract ISO metadata >from HDF5. Following your OODT approach of using Maven, the code >therefore needs to load HDF5 library (hdf-java or jhdf5) and requires to >load via JNI a shared library (*.so) during run-time. > >I have the code working fine when compiled and run manually, but when >integrated into the Maven environment of SMAP FileManager package with >Junit test, I get the following error when running the unittest (so it >compiles fine): > >testH5(gov.nasa.smap.spdm.filemgr.metadata.extractors.ISOHDF5MetExtractorT >est) Time elapsed: 1.211 sec <<< ERROR! >java.lang.NoClassDefFoundError: Could not initialize class >ncsa.hdf.hdf5lib.HDF5Constants > at ncsa.hdf.object.h5.H5File.<init>(H5File.java:169) > at ncsa.hdf.object.h5.H5File.<init>(H5File.java:122) > at >gov.nasa.smap.spdm.filemgr.metadata.extractors.ISOHDF5MetExtractorTest.tes >tH5(ISOHDF5MetExtractorTest.java:60) > >I know it loads the classes fine but keep getting this >NoClassDefFoundError exception, which indicates something wrong with the >class loading for the JVM. I've almost exhausted trying many things to no >avail. Do you have any thoughts on how Maven handles shared library >loading for JNI native libraries that may cause NoClassDefFoundError >exceptions during runtime but not compiled time? > >Attached is my pom file for FM, and the command line I use to run is the >following: >mvn clean >-Dncsa.hdf.hdf5lib.H5.hdf5lib=/project/spdm/viviant/hdf-java/lib/linux/lib >jhdf.so install > > >In the Junit test, I'm just doing one-liner: > >ncsa.hdf.object.h5.H5File h5file = new >ncsa.hdf.object.h5.H5File("/project/spdm/viviant/testdata/SMAP_L1A_RADAR_0 >4047_A_20160301T072816_R00301_002.h5"); > >Any thoughts on why I keep getting NoClassDefFoundError only when using >Maven? > >Thanks, >Vivian