Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add .so file to the java.library.path in Linux

I am working with a java application which needs a .dll file in java.library.path in windows. To run same application in Linux I have the respective .so file which should be added to java.library.path in linux machine, I didnt find any easy solution for this so far

I did put the .so in a folder which is already in the class path, but my application still complains there is no required .so file in java.library.path

I'd like to find:

  1. Ways to add .so to java.library.path
  2. How to know if its already added (when added)
like image 777
Lihkinisak Avatar asked Apr 26 '13 00:04

Lihkinisak


People also ask

What is Java library PATH in Linux?

The library path environment variable tells Java™ applications that run on AIX® and Linux®, such as the JVM, where to find shared libraries. The location of shared libraries is important 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 in Linux?

To set it temporarily, use the LD_LIBRARY_PATH environment variable on the command line. If you want to keep the changes permanent, then add this line in the shell initialization file /etc/profile (global) or ~/. profile (user-specific).


1 Answers

Add the containing directory to LD_LIBRARY_PATH before launching the application

        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/some/pathOfContainingDirectory 

Use java -XshowSettings:properties to show the java.library.path (and others) value.

like image 83
Jose Luis Martin Avatar answered Sep 16 '22 22:09

Jose Luis Martin