java: Changed JNI version to 1.6
This change is needed to compile/run with OpenJDK 7, as well as with OpenJDK 8. Signed-off-by: Andrei Vasiliu <andrei.vasiliu@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
12b5130c1a
commit
029e08669c
@@ -31,6 +31,9 @@ extern "C" {
|
|||||||
#include "jni.h"
|
#include "jni.h"
|
||||||
#include "mraa/types.h"
|
#include "mraa/types.h"
|
||||||
|
|
||||||
|
// location for defining JNI version to use
|
||||||
|
#define JNI_REQUIRED_VERSION JNI_VERSION_1_6
|
||||||
|
|
||||||
void mraa_java_set_jvm(JavaVM* vm);
|
void mraa_java_set_jvm(JavaVM* vm);
|
||||||
void mraa_java_isr_callback(void* args);
|
void mraa_java_isr_callback(void* args);
|
||||||
mraa_result_t mraa_java_attach_thread();
|
mraa_result_t mraa_java_attach_thread();
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class Spi;
|
|||||||
lang_func->java_create_global_ref = &mraa_java_create_global_ref;
|
lang_func->java_create_global_ref = &mraa_java_create_global_ref;
|
||||||
lang_func->java_delete_global_ref = &mraa_java_delete_global_ref;
|
lang_func->java_delete_global_ref = &mraa_java_delete_global_ref;
|
||||||
}
|
}
|
||||||
return JNI_VERSION_1_8;
|
return JNI_REQUIRED_VERSION;
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ mraa_java_make_env_key(void)
|
|||||||
{
|
{
|
||||||
if (globVM != NULL) {
|
if (globVM != NULL) {
|
||||||
JNIEnv* jenv;
|
JNIEnv* jenv;
|
||||||
(*globVM)->GetEnv(globVM, (void**) &jenv, JNI_VERSION_1_8);
|
(*globVM)->GetEnv(globVM, (void**) &jenv, JNI_REQUIRED_VERSION);
|
||||||
jclass rcls = (*jenv)->FindClass(jenv, "java/lang/Runnable");
|
jclass rcls = (*jenv)->FindClass(jenv, "java/lang/Runnable");
|
||||||
jmethodID runm = (*jenv)->GetMethodID(jenv, rcls, "run", "()V");
|
jmethodID runm = (*jenv)->GetMethodID(jenv, rcls, "run", "()V");
|
||||||
runGlobal = (jmethodID)(*jenv)->NewGlobalRef(jenv, (jobject) runm);
|
runGlobal = (jmethodID)(*jenv)->NewGlobalRef(jenv, (jobject) runm);
|
||||||
@@ -84,7 +84,7 @@ mraa_java_create_global_ref(void* args)
|
|||||||
{
|
{
|
||||||
if (globVM != NULL) {
|
if (globVM != NULL) {
|
||||||
JNIEnv* jenv;
|
JNIEnv* jenv;
|
||||||
(*globVM)->GetEnv(globVM, (void**) &jenv, JNI_VERSION_1_8);
|
(*globVM)->GetEnv(globVM, (void**) &jenv, JNI_REQUIRED_VERSION);
|
||||||
jobject grunnable = (*jenv)->NewGlobalRef(jenv, (jobject) args);
|
jobject grunnable = (*jenv)->NewGlobalRef(jenv, (jobject) args);
|
||||||
return (void*) grunnable;
|
return (void*) grunnable;
|
||||||
} else
|
} else
|
||||||
@@ -96,7 +96,7 @@ mraa_java_delete_global_ref(void* ref)
|
|||||||
{
|
{
|
||||||
if (globVM != NULL) {
|
if (globVM != NULL) {
|
||||||
JNIEnv* jenv;
|
JNIEnv* jenv;
|
||||||
(*globVM)->GetEnv(globVM, (void**) &jenv, JNI_VERSION_1_8);
|
(*globVM)->GetEnv(globVM, (void**) &jenv, JNI_REQUIRED_VERSION);
|
||||||
(*jenv)->DeleteGlobalRef(jenv, (jobject) ref);
|
(*jenv)->DeleteGlobalRef(jenv, (jobject) ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user