problem while getting Vector object in native C++ method.

S

shivaraj

Hi,

I am trying to use declare a new Vector object and then call it's
addElement method in native C++ method. I am facing some issue with
"jmethodID vectConstructor =
env->GetMethodID(vectorClass,"<init>","()V");"
as its throwind exception as
"excpection occuredException in thread "main"
java.lang.NoSuchMethodError: <init>"

Here with the steps i am running...

1. jclass vectorClass = env->FindClass("java/util/Vector");
if(vectorClass)
printf("\n not null");
else
printf("\n null");
2. jmethodID vectConstructor =
env->GetMethodID(vectorClass,"<init>","()V");
3. jobject result = env->NewObject(vectorClass, vectConstructor);
4. jmethodID add = env->GetMethodID(vectorClass, "addElement",
"(Ljava/lang/Object;)V");

but after the first step the result is "null". So what I suspect is its
not able to get "java/util/Vector" class. How do I resolve this
problem? Do i need to add any specific header files for this or do I
need to set something in CLASSPATH ? Please help me to resolve this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top