[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: the new guy (Getting started with ucar.netcdf.NetcdfFile)



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