[netcdf-java] NoClassDefFoundError in NetcdfFile.canOpen(String)

Hello all

I'm using the NetCDF library version 4.1 without the visadNoDods.jar file (this dependency is big! 4.3Mb). In my understanding of

http://www.unidata.ucar.edu/software/netcdf-java/reference/JarDependencies.html

this dependency is optional if I don't need to read McIDAS AREA files. This work well for normal NetCDF I/O operations. But when trying to invoke the following code:

   NetcdfFile.canOpen("myFile")

on any file that is not a NetCDF file (for example a PNG image), I get the following exception:

    java.lang.NoClassDefFoundError: visad/util/Trace
       at ucar.nc2.iosp.gempack.GempackStationFileIOSP.isValidFile:141
       (...snip...)
       at ucar.nc2.NetcdfFile.canOpen(NetcdfFile.java:412)

I can workaround with a try ... catch block. But is there any chance to have NetcdfFile.canOpen(...) to not check file format that depends on optional JAR files not present on the classpath?

        Regards,

                Martin



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: