I have first executed the command: export LD_LIBRARY_PATH=/usr/local/lib
Then I have opened .bash_profile
file: vi ~/.bash_profile
. In this file, I put:
LD_LIBRARY_PATH=/usr/local/lib export LD_LIBRARY_PATH
Then if the terminal is closed and restarted, typing echo $LD_LIBRARY_PATH
displays no result.
How to set the path permanently?
The LD_LIBRARY_PATH environment variable tells Linux applications, such as the JVM, where to find shared libraries when they are located in a different directory from the directory that is specified in the header section of the program.
How do I set the Library path under Linux operating systems? You need to use ldconfig config file and ldconfig command which creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld. so.
You should add more details about your distribution, for example under Ubuntu the right way to do this is to add a custom .conf
file to /etc/ld.so.conf.d
, for example
sudo gedit /etc/ld.so.conf.d/randomLibs.conf
inside the file you are supposed to write the complete path to the directory that contains all the libraries that you wish to add to the system, for example
/home/linux/myLocalLibs
remember to add only the path to the dir, not the full path for the file, all the libs inside that path will be automatically indexed.
Save and run sudo ldconfig
to update the system with this libs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With