ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: UnsatisfiedLinkError when invoking native library from junit task
Date Wed, 14 Jun 2006 12:35:36 GMT
Juan Jimenez wrote:
> Back in June 2004 there was a thread briefly discussing the problem of
> native libraries having dependencies on further native libraries and the
> apparent lack of support in ANT to modify Path or LD_LIBRARY_PATH as
> appropriate.  I am facing the problem (which I explain in more detail 
> below)
> and I am posting this in the hope that things have moved on or someone 
> had a
> bright idea on how to tackle this.
> ##### The Problem #####
> I use Cruisecontrol to build several branches of several different
> projects.  The build itself is done through ANT scripts which I have
> refactored extensively to avoid duplication.  As such, all projects have a
> standard location where they keep third party dependencies.  That includes
> both jar files and natibe libraries (DLLs for Windows and SOs for RHEL-3).
> Within the <junit> task I have included the following inner elements:
>            <sysproperty key="java.library.path" path="${junit.lib.path}"/>
>            <sysproperty key="LD_LIBRARY_PATH" path="${ junit.lib.path}"/>
>            <sysproperty key="PATH" path="${junit.lib.path}"/>
> where junit.lib.path is set to a path structure that includes all project
> specific dependencies (including DLLs and SOs).
> Our Java code can find any native library it needs (be it DLL or SO).
> However, if that native library tries to load further native libraries we
> get an UnsatisfiedLinkError
> Below is a sample stack trace showing that cannot find
> even though they are both in the same directory:
> java.lang.UnsatisfiedLinkError:
> /vob/gcib/etrading/projects/PricingImpl/lib/package/
> cannot open shared object file: No such file or directory at
> java.lang.ClassLoader$NativeLibrary.load(Native Method) at
> java.lang.ClassLoader.loadLibrary0( at
> java.lang.ClassLoader.loadLibrary( at
> java.lang.Runtime.loadLibrary0( at
> java.lang.System.loadLibrary( at
> irtkjava.LibLoader.loadNativeLibrary( at
> at
> Am I going to be forced to look into a nominated directory and preload
> anything that matches *.so before invoking a non-forked JVM for the unit
> tests?

This looks a bit like the problem that on windows, Java loads files 
using ::LoadLibrary, not


if they did that, then when you loaded a library from a dir, it would 
add that dir to the search path for the next libraries to load.

This is the full search order

Presumably you are running <junit> forked? I think you also need to make 
sure that your path and library search path includes the existing env 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message