I needed to force a generic server application to only bind to a specified IP address on my computer, so I got nusse to find me this code:

http://www.ryde.net/code/bind.c.txt

You can compile it with gcc -D_GNU_SOURCE -nostartfiles -fpic -shared bind.c -o bind.so -ldl

Then start the program like this:

BIND_ADDR="127.0.0.2" LD_PRELOAD=bind.so java -Djava.net.preferIPv4Stack=true -jar db4oServer.jar 8875

A similar tool seems to exist in the linux-vserver suite called chbind