This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
James Harle wrote:
Dear John,I've been trying to use your NetCDF Java Library to read and sub- sample netcdf files and netcdf datasets into the latest version of Matlab, which I had success at. I've also been trying to read in HDF5 files, but to no avail. When I try and open the file I get the following:nc = NetcdfFile.open(filename); ??? Java exception occurred: java.lang.NoClassDefFoundError at ucar.nc2.H5header.addSystemAttributes(H5header.java:2000) at ucar.nc2.H5header.makeVariable(H5header.java:1985) at ucar.nc2.H5header.makeNetcdfGroup(H5header.java:1774) at ucar.nc2.H5header.readSuperBlock(H5header.java:200) at ucar.nc2.H5header.read(H5header.java:120) at ucar.nc2.H5iosp.open(H5iosp.java:76) at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:754) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:334) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:219) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:165) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:149).when I import ucar.nc2.H5header and look at the methods available I only have the follow:Methods for class ucar.nc2.H5header:close getClass notify setDebugOutputStream wait equals hashCode notifyAll toStringI am using toolsUI-2.2.10.jar, I no pretty much nothing about Java - apart from it's taking a while for my head to get a handle on this object oriented stuff. Could you tell me whether I am doing the right thing (if you can from the limited info I have provided), or am I using the wrong *.jar, or may be some HDF5 files just can't be read?
1. im guessing a classpath problem, perhaps some classes or jars that are interfering? do you have other jars or classes in your classpath?
2. Look in toolsUI-2.2.10.jar and make sure that ucar.nc2.units.DateUnit is in the jar.
3. Download a new copy of toolsUI-2.2.10.jar in case it got damaged.4. otherwise, see if you can create a small program that recreates the problem and send it to me.