LinuxQuestions.org
Visit Jeremy's Blog.
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 09-30-2004, 08:48 PM   #1
sherryanee
LQ Newbie
 
Registered: Sep 2004
Posts: 4

Rep: Reputation: 0
System.Loadlibrary in Java


I've been working with JNI , RMI for a few days. THere is System.Loadlibrary(native) in ma.java file. In Redhat 9, when use rmic command, it saids "Exception in thread "main" java.lang.UnsatisfiedLinkError: native: file not found". While in UNix , it works well. WHat's the possible problem here ? THanks.
 
Old 10-06-2004, 01:31 AM   #2
MidnightCmdr
LQ Newbie
 
Registered: Oct 2004
Location: Austin TX
Distribution: Debian
Posts: 17

Rep: Reputation: 0
In your code, are you calling that System.loadLibrary() with quotes (") around the library name? In your post you put

System.loadLibrary(native)

but it should be

System.loadLibrary("native")

where "native" is the name of the system library you want to load. For example, if I want to load the libary contained in the system file "libfoo.so", I would do this:

System.loadLibrary("foo")

The other problem you usually run into in this case is not having "libfoo.so" in your system's library path. If "libfoo.so" is in the directory "/usr/foo/lib", then you would need to pass that directory to the JVM when you start your program, like so:

java -cp [your classpath] -Djava.library.path=/usr/foo/lib [your main class]

Check out the System class docs for more detail on this stuff:

http://java.sun.com/j2se/1.4.2/docs/...ng/System.html
 
Old 10-06-2004, 11:09 PM   #3
sherryanee
LQ Newbie
 
Registered: Sep 2004
Posts: 4

Original Poster
Rep: Reputation: 0
thanks a lot

hi,

It seems that nobody answers this question for a few days and I almost give up. I know it must be the ".so not in the lib path" problem, but I don't know how to set it. Now I can try it.

Thank you very much!

sherryanee
 
  


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
In UNIX/LINUX, some functions like LoadLibrary and GetProcAddress? chenjifu Programming 3 04-20-2009 02:24 PM
Is Java Desktop System really Java? NCC-1701&NCC-1701-D Programming 7 06-19-2005 03:55 PM
system call in java alaios Programming 1 01-18-2005 09:54 AM
2 Questions: java calling system commands? PERL vs Java? randomx Programming 28 11-28-2003 08:24 PM
Need Java on my system Methos Linux - Software 1 02-19-2003 11:48 AM

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

All times are GMT -5. The time now is 08:30 PM.

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