[netcdf-java] compiler does not find the NetcdfFileWriter identifiers

Dear netcdf-java Users,
In my previous email, I asked if there is a way to convert String variables to 
java code to build a NetCDF file from strings. I have some Strings which 
contain the commands to write a netCDF. For example:

String Variable contains the following strings:
'Variable time; '
'time = ncfile.addVariable(null, "time", DataType.Double, "time");'

String DataA contains:
'ArrayDouble.D1 timeData = new ArrayDouble.D1(countLinesResult); '
'Index ima = timeData.getIndex();'

String DataD contains:
'timeData.setDouble(ima.set(timeIdx),ValueD.get(timeIdx)); ' where ValueD is 
the data what are added to timeData array inside a for loop.

String DataNC contains:
'ncfile.write(time, timeData); '

each string is public static String. These stings are in NetCDF_writer Class 
static void getDataNc method.

I tried to convert them with InMemoryJavaCompiler 
(https://github.com/trung/InMemoryJavaCompiler) as:

NetcdfFileWriter ncfile = 
NetcdfFileWriter.createNew(NetcdfFileWriter.Version.netcdf4, location, null);
Dimension timeDim = ncfile.addUnlimitedDimension("time");
StringBuffer sourceCode = new StringBuffer();
                sourceCode.append("package meteoread;\n");
                sourceCode.append("public class NetCDF_writer {\n");
                sourceCode.append("   static void getDataNc(int id1, int id2, 
String listString, String location, String Stimenc, String ETimenc)throws 
Exception {" +Variables +" ncfile.create();" + "\n" + DataA + DataD + 
DataNC+"}");
                sourceCode.append("}");
                 Class<?> Netcdf_writer = 
InMemoryJavaCompiler.compile("meteoread.NetCDF_writer", sourceCode.toString());

Unfortunately, I got several cannot find symbol error messages. The compiler 
does not find the NetcdfFileWriter identifiers even though I imported 
ucar.nc2.* and ucar.ma2.* packages. Could someone write to me how I should fix 
this issue?
Thank you for your help in advance!
Kind regards,
Beata

Beáta Szabó-Takács Ph.D
Department of Atmospheric Matter Fluxes and Long-Range Transport
Global Change Research Institute CAS
Bělidla 986/4a
603 00 Brno
Czech Republic

+420 602 975 356
www.czechglobe.cz<http://www.czechglobe.cz>