[BRLTTY] BRLTTY Java bindings -- UnsatisfiedLinkError

Simon Meers drmeers at gmail.com
Wed May 27 08:35:48 EDT 2009


>
> Err, is that really correct?  AIUI packages are dot-separated.


Yes, but apparently not for JNI:
http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/functions.html
"name: a fully-qualified class name (that is, a package name, delimited by “
/”, followed by the class name)"

 When you produce patches, please use the -u option.


Oops:

--- bindings.c    2009-05-27 22:17:32.000000000 +1000
+++ bindings.orig    2009-05-27 22:05:58.000000000 +1000
@@ -66,7 +66,7 @@
     char message[lenmsg + 2 + lenerr + 1];
     snprintf(message, sizeof(message), "%s: %s", msg, error);

-    if (!(jcexcep = (*jenv)->FindClass(jenv, "org/a11y/BrlAPI/Error"))) {
+    if (!(jcexcep = (*jenv)->FindClass(jenv, "org.a11y.BrlAPI.Error"))) {
       ThrowException(jenv, ERR_NULLPTR, "ThrowBrlapiErrorFindClass");
       return;
     }
@@ -97,7 +97,7 @@
   }
   (*env)->SetByteArrayRegion(env, jbuf, 0, size, (jbyte *) buf);

-  if (!(jcexcep = (*env)->FindClass(env, "org/a11y/BrlAPI/Exception"))) {
+  if (!(jcexcep = (*env)->FindClass(env, "org.a11y.BrlAPI.Exception"))) {
     ThrowException(env, ERR_NULLPTR, "exceptionHandlerFindClass");
     return;
   }
@@ -130,7 +130,7 @@
   jfieldID handleID; \
   GET_CLASS(jenv, jcls, jobj, ret); \
   GET_ID(jenv, handleID, jcls, "handle", "J", ret); \
-  handle = (void*) (intptr_t) (*jenv)->GetLongField(jenv, jobj, handleID);
\
+  handle = (void*) (intptr_t) (*jenv)->GetLongField(jenv, jcls, handleID);
\
   if (!handle) { \
     ThrowException((jenv), ERR_NULLPTR, "connection has been closed"); \
     return ret; \
@@ -155,8 +155,7 @@
     ThrowException(jenv, ERR_OUTOFMEM, __func__);
     return -1;
   }
-
-  (*jenv)->SetLongField(jenv, jobj, handleID, (jlong) (intptr_t) handle);
+  (*jenv)->SetLongField(jenv, jcls, handleID, (jlong) (intptr_t) handle);

   env = jenv;

@@ -232,7 +231,7 @@

   brlapi__closeConnection(handle);
   free((void*) (intptr_t) handle);
-  (*jenv)->SetLongField(jenv, jobj, handleID, (jlong) (intptr_t) NULL);
+  (*jenv)->SetLongField(jenv, jcls, handleID, (jlong) (intptr_t) NULL);
 }

 JNIEXPORT jstring JNICALL Java_org_a11y_BrlAPI_Native_getDriverName(JNIEnv
*jenv, jobject jobj) {
@@ -264,7 +263,7 @@
     return NULL;
   }

-  if (!(jcsize = (*jenv)->FindClass(jenv, "org/a11y/BrlAPI/DisplaySize")))
{
+  if (!(jcsize = (*jenv)->FindClass(jenv, "org.a11y.BrlAPI.DisplaySize")))
{
     ThrowException(jenv, ERR_NULLPTR, __func__);
     return NULL;
   }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mielke.cc/pipermail/brltty/attachments/20090527/3939d572/attachment.html 


More information about the BRLTTY mailing list