+static void* smx_ctx_java_thread_run(void *data) {
+ smx_ctx_java_t context = (smx_ctx_java_t)data;
+ //Attach the thread to the JVM
+ JNIEnv *env;
+ JavaVM *jvm = get_current_vm();
+ (*jvm)->AttachCurrentThread(jvm, (void **) &env, NULL);
+ //Wait for the first scheduling round to happen.
+ xbt_os_sem_acquire(context->begin);
+ //Execution of the "run" method.
+ jmethodID id = jxbt_get_smethod(env, "org/simgrid/msg/Process", "run", "()V");
+ xbt_assert( (id != NULL), "Method not found...");
+ (*env)->CallVoidMethod(env, context->jprocess, id);
+
+ return NULL;
+}
+