JNI + Java WebStart problem.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andrei_Bica
Posted On:   Friday, December 5, 2003 02:42 AM

Hermix2 Support Client I have an application wich use native code. To start the application I use Java WebStart. The application is located in H2AChat.zip and the native library in AudioN.zip. The jnlp file: ----------------------------------------------------------- <?xml version="1.0" encoding="utf-8"?> spec="1.0+" codebase="http://jimmy.integrasoft.ro/support" href="H2Support.jnlp"> IntegraSoft Hermix 2 client for support    More>>
Hermix2 Support Client

I have an application wich use native code. To start the application I use Java WebStart.

The application is located in H2AChat.zip and the native library in AudioN.zip.

The jnlp file:


-----------------------------------------------------------



<?xml version="1.0" encoding="utf-8"?>



spec="1.0+"

codebase="http://jimmy.integrasoft.ro/support"

href="H2Support.jnlp">





IntegraSoft



Hermix 2 client for support























jimmy.integrasoft.ro

guest

q





------------------------------------------------------------

The problem occurs in the following function. This function make a callback to a java function
which make a notify.



void notifyListeners(char* frame,int size,int sizeInMs,int type,bool noise){



JNIEnv* env;

jclass clazz;

jmethodID mid;



if(_javaVM == NULL) return;



_javaVM->AttachCurrentThread((void**)&env,NULL);



clazz = env->FindClass("ro/integrasoft/audio/AudioCapture");

mid = env->GetStaticMethodID(clazz,"NotifyListeners","([BIIIZ)V");

// resizeing _frame if necessary

if(size>_frameSize || _frame == NULL){

if(_frame != NULL) env->DeleteGlobalRef(_frame);

_frameSize = size;

// we make it global so the GC do not delete it

_frame = (jbyteArray)env->NewGlobalRef(env->NewByteArray(_frameSize));

}

env->SetByteArrayRegion(_frame,0,size,(jbyte*)frame);

env->CallStaticVoidMethod(clazz,mid,_frame,(jint)size,(jint)sizeInMs,(jint)type,(jboolean)noise);

_javaVM->DetachCurrentThread();

}



The function FindClass return NULL, so the "ro.integrasoft.audio.AudioCapture" wasn't found (if I try to find a standard class like java.lang.String it is found). But this doesn't happen if the application isn't started with Java Web Start. If the application is started in regular way (with java.exe ... ) the problem doesn't appear and everything works fine (the class ro.integrasoft.audio.AudioCapture is found).




What could be the problem?

   <<Less
About | Sitemap | Contact