Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is LD_LIBRARY_PATH and how to use it?

I take part in developing a Java project, which uses some C++ components, thus I need Jacob.dll. (on Windows 7)

I keep getting java.lang.UnsatisfiedLinkError: no JacobDB in java.library.path no matter where I put Jacob.dll....

I looked for possible decisions and the one that I haven't tried so far is setting the LD_LIBRARY_PATH variable, pointing at the .dll file.

I have little experience and I'm not familiar with what should be the meaning and usage of that variable - can you help me?

like image 411
karla Avatar asked Aug 22 '11 13:08

karla


People also ask

What does export LD_LIBRARY_PATH do?

LD_LIBRARY_PATH is an environmental variable used in Linux/UNIX Systems. It is used to tell dynamic link loaders where to look for shared libraries for specific applications. It is useful until you don't mess with it.

What is the difference between path and LD_LIBRARY_PATH?

PATH is for specifying directories of executable programs. LD_LIBRARY_PATH is used to specify directories of libraries. From other point of view, PATH is used primarily by the shell, while LD_LIBRARY_PATH is used by the dynamic loader (usually ld-linux.so ).

What is the value of LD_LIBRARY_PATH?

The value of the environment variable LD_LIBRARY_PATH is a colon-separated (:) set of directories where libraries are searched for first before the standard set of directories. If you are running on a Solaris system, the LD_LIBRARY_PATH environment variable is used to define the native library path.


1 Answers

LD_LIBRARY_PATH is the predefined environmental variable in Linux/Unix which sets the path which the linker should look in to while linking dynamic libraries/shared libraries.

LD_LIBRARY_PATH contains a colon separated list of paths and the linker gives priority to these paths over the standard library paths /lib and /usr/lib. The standard paths will still be searched, but only after the list of paths in LD_LIBRARY_PATH has been exhausted.

The best way to use LD_LIBRARY_PATH is to set it on the command line or script immediately before executing the program. This way the new LD_LIBRARY_PATH isolated from the rest of your system.

Example Usage:

$ export LD_LIBRARY_PATH="/list/of/library/paths:/another/path" $ ./program 

Since you talk about .dll you are on a windows system and a .dll must be placed at a path which the linker searches at link time, in windows this path is set by the environmental variable PATH, So add that .dll to PATH and it should work fine.

like image 57
Alok Save Avatar answered Oct 11 '22 14:10

Alok Save