LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-12-2005, 12:01 PM   #1
sabliny
LQ Newbie
 
Registered: Oct 2005
Posts: 7

Rep: Reputation: 0
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.
 
Old 10-13-2005, 07:16 AM   #2
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
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)
 
Old 10-13-2005, 11:36 AM   #3
csfalcon
Member
 
Registered: Jun 2004
Location: MD
Distribution: Fedora Core
Posts: 269

Rep: Reputation: 31
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.

Last edited by csfalcon; 06-09-2008 at 11:24 AM.
 
Old 11-17-2005, 06:13 PM   #4
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 43
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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
print problem with Java and C JNI trutnev Programming 0 06-20-2005 12:28 PM
Regarding interfacing of C with JAVA thru JNI nedian123 Programming 3 07-28-2004 03:39 PM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 05:20 AM
how to get the *.dll or *.so by applying JNI under the java, c++ and fortran stiphon Programming 3 06-04-2004 06:32 AM
UnsatisfiedLinkError on JNI access to Shared Library Kavinjka Linux - Software 1 08-25-2003 07:08 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration