I have a java class (repr Structure in C++) public class CONF { String itemParFile; String consFile; String overlapFile; String explosureFile; }
public class CONFIG { private CONF confList; }
My java program which calls the c++ dll is as follows public class CatAlgorithm { public CONFIG configObject; public CONFIG getConfigObject() { return configObject; }
public void setConfigObject(CONFIG configObject) { this.configObject = configObject; } }
In my c++ program I do the following ofstream outdata; outdata.open("controlfile.dat"); /* Get a reference to object class */ jclass configCls = env->FindClass("CONFIG"); jmethodID oneCtorID = env->GetMethodID(configCls, "<init>", "()V"); jfieldID confListID = env->GetFieldID(configCls, "confList", "Ljava/lang/Object;"); outdata << "field to be set " << confListID << endl; jclass catAlgoCls = env->FindClass("CatAlgorithm"); jfieldID configField = env->GetFieldID( catAlgoCls, "configObject","Ljava/lang/Object;"); outdata << "field to be set " << configField << endl; outdata.close();
But I am getting the following exception Exception in thread "main" java.lang.NoSuchFieldError: configObject
Can some one let me know the correct syntax for getting a field and method calls and how can I set the same from c++ to Java