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:
- Ways to add
.so
tojava.library.path
- How to know if its already added (when added)
I used java -XshowSettings:properties method and found the path of a previously set folder and copied my so file to that folder
I had a lot of trouble figuring this out, please make sure that you have
lib
prefix in the library name.So steps,
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/some/pathOfContainingDirectory"
Rename libraries to have lib as a prefix. [Add this as part of build script]
Check this answer for detailed explanation https://stackoverflow.com/a/3987567/2076566
Add the containing directory to
LD_LIBRARY_PATH
before launching the applicationUse
java -XshowSettings:properties
to show the java.library.path (and others) value.