Search code examples
javalinuxjna.so

Unsatisfied Link Error (No such file or directory) on Linux, while file is available at given path


I am loading some .so files in my Java code using System.load("home/projects/proj/my.so"). Where I have given complete path of my .so files. But in my logs I am getting below error:

sys:Err: java.lang.UnsatisfiedLinkError: Unable to load library 'home/projects/proj/my.so'

home/projects/proj/my.so : cannot open shared object file: No such file or directory

Native library (linux-x86-64/home/projects/proj/my.so) not found in resource path ([])

Same code is working fine in windows and if I create a environment variable to this path. Everything starts working fine. So not able to understand why it's saying No such file or directory?

I have gone through multiple articles, but no help.


Solution

  • Try to provide full path your code showing as relative path so make like System.load("/home/projects/proj/my.so") or correct full path form /