diff options
author | Julien Decaen <[email protected]> | 2016-10-28 11:22:29 +0200 |
---|---|---|
committer | petreeftime <[email protected]> | 2016-10-28 13:35:36 +0200 |
commit | 2c3706fc16bf22c28ea3051703e98fc27b73f365 (patch) | |
tree | 3a0c749b33ae6a1485449c60812f5702665743da /java/jni/helper.cxx | |
parent | d9c777bc576b5365c2064d55fe872f272faa92e8 (diff) |
Fix JNI FindClass "tinyb/BluetoothNotification" not found
- Issue #52 : JNI call to findClass BluetoothNotification failed
- This issue happen with javafx application,
but not with "simple" java application.
- This issue happen only with "tinyb/BluetoothNotification" interface.
- Using the callback reference to retrieve the class instead of using
FindClass works fine.
Signed-off-by: Julien Decaen <[email protected]>
Diffstat (limited to 'java/jni/helper.cxx')
-rw-r--r-- | java/jni/helper.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/java/jni/helper.cxx b/java/jni/helper.cxx index 6952184f..3ff6ffb4 100644 --- a/java/jni/helper.cxx +++ b/java/jni/helper.cxx @@ -52,6 +52,17 @@ jclass search_class(JNIEnv *env, const char *clazz_name) return clazz; } +jclass search_class(JNIEnv *env, jobject obj) +{ + jclass clazz = env->GetObjectClass(obj); + if (!clazz) + { + std::string error = "no class found: "; + throw std::runtime_error(error); + } + return clazz; +} + jmethodID search_method(JNIEnv *env, jclass clazz, const char *method_name, const char *prototype, bool is_static) { |