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.
On Feb 27, 8:25pm, David Olivares wrote: > Subject: the new guy > import ucar.netcdf.NetcdfFile; > import java.io.IOException; > > > > class mytest { > > public static void main(String argv[]){ > String fname; > try { > fname = new String("sgpmfrsrC1.a1.970913.000000.cdf"); > > NetcdfFile myfile = new NetcdfFile(fname, true); > } > catch (IOException ee) { > System.out.println(ee); > } > } > } > > !!!!!!!!!!!!!!!HELP!!!!!!!!! > with something so simple like this I am getting errors > it COMPILES FINE > but then when I run it > i get: > java.lang.NoClassDefFoundError: ucar/netcdf/NetcdfFile > at mytest.main(mytest.java:12) > and I have the class NetcdfFile. > please get back to me > > David >-- End of excerpt from David Olivares This error means that the class loader couldn't find Class ucar/netcdf/NetcdfFile. Reset your CLASSPATH to include the root of the netcdf classes. For example, if the directory 'ucar' is in /home/olivares/java/classes, %setenv CLASSPATH /home/olivares/java/classes:${CLASSPATH} BTW, you don't need to construct the String being assigned to fname, it exists already. You can simply say fname ="sgpmfrsrC1.a1.970913.000000.cdf"; -glenn