In the last episode (Jun 14), David Gourdelier said:
I don't think the problem is FreeBSD specific. I got this problem on Linux and fixed it and before I had the same problem with FreeBSD (didn't try to fix it). I think the configure script of this module is broken and that's the only reason. I got it to work by simply adding every libs Java needed in my ld.so.conf (it also seems there was more than the configure say), modify by hand configure to force it to say that my JVM really really works and to shut up and then it worked fine. The thing I don't get is why gcc can't find the Java libraries if you give all the paths with -L.
gcc did; the runtime linker couldn't. They why the compile worked but ./conftest failed. On Solaris, the java libraries have an embedded $ORIGIN in the rpath so they know where their dependencies are. Tru64 puts symlinks to the java libs in /usr/shlib. AIX's java libs don't seem to have dependencies. On FreeBSD and Debian, it looks like there is a java wrapper script that sets LD_LIBRARY_PATH dynamically, depending on which jvm you want to run.