View Single Post
  #1 (permalink)  
Old 07-03-2008, 02:55 PM
hannehomuth's Avatar
hannehomuth hannehomuth is offline
Member
 
Join Date: Jul 2008
Location: Sommerfeld (Brandenburg, Germany)
Posts: 35
hannehomuth is on a distinguished road
[SOLVED] JNI gives Error undefined Symbol, do I miss an Headerfile?
Hello Everyone,
at first thank you for reading this post. I'd like to you use the gnome keyring manager to save/load Passwords out of my own java app. If tried things with dbus, but it seems not to work. Now I wanna to write my own wapper for the method calls to use the keyring manager. I started to write my Java class. It looks like this.
Code:
/** * * @author jhomuth */ public class KeyRingConnector { public native void addPasswordToKeyRingManger(); public native boolean isKeyRingDaemonAvailable(); static { Runtime.getRuntime().load("/usr/lib/libdbus-1.so.3"); Runtime.getRuntime().load("/usr/lib/libglib-2.0.so.0"); Runtime.getRuntime().load("/lib/i686/cmov/libc.so.6"); Runtime.getRuntime().load("/usr/lib/libpcre.so.3"); Runtime.getRuntime().load("/lib/libselinux.so.1"); Runtime.getRuntime().load("/lib/ld-linux.so.2"); Runtime.getRuntime().load("/usr/lib/libgnome-keyring.so"); Runtime.getRuntime().load("/home/jhomuth/projekte/LDAP/src/de/sourcepark/ldap/KeyRingConnector.dll"); } }

Furthermore I wrote the C Class which looks like this

Code:
//File: KeyRingConnector.c #include "de_sourcepark_ldap_KeyRingConnector.h" #include <jni.h> #include <stdio.h> #include <stdlib.h> #include <glib.h> #include <gnome-keyring.h> JNIEXPORT void JNICALL Java_de_sourcepark_ldap_KeyRingConnector_addPasswordToKeyRingManger (JNIEnv *env, jobject obj) { printf("Damm I used JNI"); } JNIEXPORT jboolean JNICALL Java_de_sourcepark_ldap_KeyRingConnector_isKeyRingDaemonAvailable (JNIEnv *env, jobject obj) { #define false 0 #define true (!false) if(gnome_keyring_is_available()) { return true; } else return false; }
But when I wanna run my Programm I get an java.lang.UnsatisfiedLinkError

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: /home/jhomuth/projekte/LDAP/src/de/sourcepark/ldap/KeyRingConnector.dll: /home/jhomuth/projekte/LDAP/src/de/sourcepark/ldap/KeyRingConnector.dll: undefined symbol: gnome_keyring_is_available

I think I'm missing a Headerfile in my C Class or do I have to load another library?

Thx for help
Reply With Quote
Sponsored Links