System.load("...");

  • Follow


Do I have to configure - on a Unix-like system - the configuration file 
of the dynamic loader (/etc/ld.so.conf) with the pathname of the shared 
object to be loaded by System.load("...") or does the VM all by itself?

Example:

System.load(/path/to/file.so);

Michael
0
Reply mw (31) 10/26/2004 8:57:38 AM

On Tue, 26 Oct 2004 10:57:38 +0200, Michael Wiedmann wrote:
> Do I have to configure - on a Unix-like system - the configuration file 
> of the dynamic loader (/etc/ld.so.conf) with the pathname of the shared 
> object to be loaded by System.load("...") or does the VM all by itself?
> 
> Example:
> 
> System.load(/path/to/file.so);

No, you don't need to configure anything.

However if you use System.loadLibrary() instead, you only need to
specify an unadorned library name (i.e. without a path or any system
specific prefixes and suffixes) and the dynamic loader will find the
correct file using search rules specific to your system. This is more
flexible and portable.

On your Unix-like system, that means that you can either update
/etc/ld.so.conf, or set an environment variable such as
LD_LIBRARY_PATH before starting the application.

/gordon

-- 
[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e
0
Reply not108 (1060) 10/26/2004 9:13:41 AM


Gordon Beaton wrote:
....
> On your Unix-like system, that means that you can either update
> /etc/ld.so.conf, or set an environment variable such as
> LD_LIBRARY_PATH before starting the application.

And what would be the equivalent on a Windows (or even Mac OS X) system?

Michael
0
Reply mw (31) 10/26/2004 9:28:31 AM

On Tue, 26 Oct 2004 11:28:31 +0200, Michael Wiedmann wrote:
> Gordon Beaton wrote:
> ...
>> On your Unix-like system, that means that you can either update
>> /etc/ld.so.conf, or set an environment variable such as
>> LD_LIBRARY_PATH before starting the application.
> 
> And what would be the equivalent on a Windows (or even Mac OS X) system?

Windows uses the PATH to find dlls.

AFAIK, the unix-like description holds for OS X as well, but read the
man page for ld or ld.so to be sure.

/gordon

-- 
[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e
0
Reply not108 (1060) 10/26/2004 9:40:21 AM

On 26 Oct 2004 11:40:21 +0200, Gordon Beaton wrote:
> AFAIK, the unix-like description holds for OS X as well, but read the
> man page for ld or ld.so to be sure.

Hmm, according to this:

  http://developer.apple.com/qa/java/java28.html

.... it seems the environment variable is called DYLD_LIBRARY_PATH on
OSX, but other sources mention LD_LIBRARY_PATH as well. YMMV.

/gordon

-- 
[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e
0
Reply not108 (1060) 10/26/2004 10:58:56 AM

Michael Wiedmann <mw@miwie.in-berlin.de> writes:

> And what would be the equivalent on a Windows (or even Mac OS X) system?

The core is that Java uses the System property "java.library.path" to
look for the shared libraries; how this is initialized is system
dependent. But you can specify it yourself on the ocmmand line, e.g.

java -Djava.library.path=. -jar myapp.jar
0
Reply tor.iver.wilhelmsen (759) 10/27/2004 8:08:16 AM

5 Replies
29 Views

(page loaded in 0.075 seconds)


Reply: