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.
>From: "Jun Chen" <address@hidden> >Subject: NetCDF for Java >Organization: Bay Area Air Quality Management District >Keywords: 199804211739.LAA21442 netCDF Java Jun, > I downloaded the tar file and untar at UNIX, then ftp to my Window 95, I put > ucar under classes subdirectory to windows\java, and added > c:\windows\java\ucar\multiarray and c:\windows\java\ucar\netcdf to Java > Virtual machine search directory inside VJ++ for source files and class > files. I don't think you should need to add these directories to your search directory, since they should be found by the package name hierarchy if the ucar/ directory is in the right place. > ... Then I open the TestNetcdf.java under tests subdirectory, got > following errors while trying to build it. I'm very new at Java, and thank > you very much for your help :-) > > > > Deleting intermediate files and output files for project 'TestNetcdf - Java > Virtual Machine Debug'. > --------------------Configuration: TestNetcdf - Java Virtual Machine > Debug-------------------- > Compiling... > Microsoft (R) Visual J++ Compiler Version 1.01.7022 > Copyright (C) Microsoft Corp 1996. All rights reserved. > E:\Download\ucar\src\ucar\tests\TestNetcdf.java(24,8) : error J0025: > Expected statement > E:\Download\ucar\src\ucar\tests\TestNetcdf.java(28,9) : error J0025: > Expected statement > E:\Download\ucar\src\ucar\tests\TestNetcdf.java(29,9) : error J0025: > Expected statement > E:\Download\ucar\src\ucar\tests\TestNetcdf.java(32,10) : error J0025: > Expected statement > E:\Download\ucar\src\ucar\tests\TestNetcdf.java(116,10) : error J0025: > Expected statement > E:\Download\ucar\src\ucar\tests\TestNetcdf.java(126,10) : error J0025: > Expected statement > E:\Download\ucar\src\ucar\tests\TestNetcdf.java(199,9) : error J0025: > Expected statement > E:\Download\ucar\src\ucar\tests\TestNetcdf.java(200,9) : error J0025: > Expected statement > Error executing jvc.exe. > > TestNetcdf - 8 error(s), 0 warning(s) These are not very helpful error messages. I can't tell from these what the problem is ... > Where line 24 is: final int rank = ma.getRank(); > Where line 28 is: final int [] dims = ma.getLengths(); > Where line 29 is: final int last = dims[0] -1; > Where line 32 is: final MultiArray inner = > Where line 116 is: final int nlats = latD.getLength(); > Where line 126 is: final int nlons = lonD.getLength(); > Where line 199 is: final Schema sc2 = new Schema(nc); > Where line 200 is: final NetcdfFile clone = new NetcdfFile("clone.nc", true, > true, > > seems VJ++ didn't load the Netcdf Java classes correctly, also question > about: > import ucar.multiarray.MultiArray; > > ucar.multiarray.MultiArray is interface, not class, right? ma.getRank() is > under ucar.multiarray.MultiArray? > > Please help :-) The MultiArray interface extends the MultiArrayInfo interface, which has the getRank() method. So anything that implements the MultiArray interface will have the getRank() method. Sorry I can't be more helpful, but it sounds like you just need to get your CLASSPATH set up right for using third-party Java packages, and I don't know the details of doing that with J++. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu