问题
I am having java.lang.UnsatisfiedLinkError problem while running a job from Jenkins.
<error message="no JSTAF in java.library.path" type="java.lang.UnsatisfiedLinkError">java.lang.UnsatisfiedLinkError: no JSTAF in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
Basically I need to set LD_LIBRARY_PATH
and when this is set, it works fine from command line execution. For example, when I set LD_LIBRARY_PATH
like following:
export LD_LIBRARY_PATH=</proj/lib>:$LD_LIBRARY_PATH
Upon setting, the code execution works fine from command line.
I have tried to set this LD_LIBRARY_PATH
using the EnvInjectPlugin
and injected the LD_LIBRARY_PATH
.
Still I am not sure why Jenkins is not picking up this LD_LIBRARY_PATH
. How to set this up so that Jenkins job execution will work?
回答1:
I posted an answer to a similar question yesterday here: KDevelop4: Error while loading shared libraries
In practice, LD_LIBRARY_PATH is deprecated in many Linux OS. Use config files in /etc/ld.so.conf.d for that and run ldconfig
before starting Jenkins. (see the above cited post)
EDIT [solution]:
after having discussed it in chat, the problem has been solved by adding :
#!/bin/bash
export LD_LYBRARY_PATH=${LD_LIBRARY_PATH}:<myPathForJenkins>
in a short script in /etc/profile.d/ and setting it executable with chmod +x
来源:https://stackoverflow.com/questions/21444198/how-to-set-ld-library-path-on-jenkins