First, run(`echo $PATH`) will not work: that is interpolating a Julia variable named PATH into the arguments used for launching echo, which fails since you haven’t (and shouldn’t) define a Julia variable named PATH.
(Realize that run is not launching a shell (like bash) and then passing it a string, it’s instead spawning programs directly. If you want a shell command, you have to launch the shell yourself, e.g. via run(`bash -c "echo \$PATH"`).)
What you want to make sure the path environment variables are set correctly. For example, you can check the PATH environment variable in Julia with ENV["PATH"] (without using run). However, if you are opening .so files I’m guessing you are on a Unix variant, in which case the relevant environment variable is LD_LIBRARY_PATH (which tells the runtime linker where to find shared libraries), not PATH (which tells the shell where to find executables).