Changing executable dependency

hello,

can anyone help in changing the executable dependency on a certain shared library. eg, .. say i am having an executable by name utest. when i run UNIX ldd command on it then it shows the libraries on which it depends as follows:

ldd release/utest
release/utest needs:
         /usr/lib/libxnet.a(shr_64.o)
         /usr/lib/libpthread.a(shr_xpg5_64.o)
         /usr/lib/libdl.a(shr_64.o)
         /usr/lib/libC.a(shr_64.o)
         /usr/java6//jre/bin/classic//libjvm.so

Clearly it shows dependency on /usr/java6//jre/bin/classic//libjvm.so

WHat i want is that instead of depending on libjvm.so present in path /usr/java6//jre/bin/classic// , the exe utest should depend of libjvm.so present in any other path. I want to do this on the fly .... Can anyone suggest. Also, the ldd should show dependeny on new libjvm.so after modification.

Any suggestions?

Which "any other path" would you like it to depend on? It has to depend on something. Usually it's the path itself that's generic, a symbolic link that just points to the latest JRE.

What's your system?

Hello,
the path can be anything ..right?

let's say its /root/abc/def/mng/hjf/libjvm.so

I am on AIX 5.3 64 bit ....

---------- Post updated 02-17-12 at 06:53 AM ---------- Previous update was 02-16-12 at 09:28 PM ----------

There are couple of instances that there is no reply to my posts through this forum which i always look up as an expert forum. its strange that even problems which have simpler solutions dont get response within time. I had been observing this for the past 3-4 posts of mine. are the experts not looking frequently at the posts? or have the experts left this forum?

--------------------
btw the above problem gets resolved when you add "appropriate" path to the environment variable "LIBPATH" on AIX.
----------------------

define the environment variable LD_PRELOAD to point to a valid .so, probably in /etc/profile, or in some init script that is relevant to your problem.

export LD_PRELOAD=/path/to/another/libjvm.so

This will NOT work with setuid exectuable programs.

Okay - now please tell us what problem you are trying to fix, before you do this and break something else. We already know you believe this solves a problem.

actually using LIBPATH on aix solved my problem. how actually LD_PRELOAD maked the difference? is this supported on all platforms?