LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 04-08-2010, 10:12 AM   #1
is noname
LQ Newbie
 
Registered: Dec 2009
Posts: 11

Rep: Reputation: 0
use function c in java


i am beginner in java ..
i want to compile function c in java and compile library is success..
when i call the library in java and error is :

Exception in thread "main" java.lang.UnsatisfiedLinkError: no libfunc.so in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1689)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at main.main(main.java:3)


main.java
============
public class main {
public static void main(String argv[]) {
System.loadLibrary("libfunc.so");
System.out.println(example.getMy_variable());
System.out.println(example.fact(5));
System.out.println(example.get_time());
}
}

Thankss guyss...
 
Old 04-08-2010, 12:09 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Do you specify a "java.library.path"?

Quote:
EXAMPLE:
java -Djava.library.path=/home/ME/workspace/JNI Hello
You can also Google for keywords like "Linux JNI java.lang.UnsatisfiedLinkError LoadLibrary" for more details.

'Hope that helps .. PSM
 
  


Reply



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
compile function c to java is noname Programming 1 04-06-2010 03:10 AM
call a java function from a c program using jni joel2001k Programming 2 02-01-2010 07:46 AM
log base 2 function in Java manolakis Programming 4 10-26-2007 10:13 AM
paint function in java not working mathimca05 Linux - Newbie 4 10-26-2007 06:36 AM
Java function return value cannot be resolved mohtasham1983 Programming 6 10-25-2007 12:11 PM

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

All times are GMT -5. The time now is 12:05 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