LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   JAVA JNI program to access shared library (https://www.linuxquestions.org/questions/programming-9/java-jni-program-to-access-shared-library-372293/)

sabliny 10-12-2005 11:01 AM

JAVA JNI program to access shared library
 
Operating system: Red Hat Linux 2.4.21-4.EL.
GUI interface: GNOME

I am writing a JAVA JNI program using JDK 1.5.0_04 version and netbeans 4.1 IDE. I am trying to access a shared library called "libdfa.so" that was written in GCC compiler.

I have placed this "libdfa.so" library in the JAVA CLASSPATH

I used the statement : System.loadLibrary("dfa");

- when I run the program from within netbeans, I get the error message :

Exception in thread "main" java.lang.UnsatisfiedLinkError: no dfa in
java.library.path.

* Is there any more environment varaibales I need to set ?

* Where do I place my "libdfa.so"?

* Is this the right syntax?

- Using GUI Natutilus 2.2.4 ( a graphical shell for GNOME), I tried to run
The jar file by double clicking on it, and nothing happens. It won't run.

* How do I run it from the GUI session?



Thanks in advance.

Sabliny.

mrcheeks 10-13-2005 06:16 AM

have a look at the jni tutorial. Why would you place a so file in the classpath?? use LD_LIBRARY_PATH and add options to find the library in the project run options(netbeans)

csfalcon 10-13-2005 10:36 AM

yes, the lib file should be in LD_LIBRARY_PATH instead. This might help you

JNI

sorry, can't help you with settings netbeans, never used it.

taylor_venable 11-17-2005 05:13 PM

JNI In A Nutshell
 
Great JNI tutorial, csfalcon. I was having some troubles with JNI myself; your page takes a lot of information and makes it easily accessible. Nice work; it sure made my life a little easier!


All times are GMT -5. The time now is 06:09 AM.