[fedora-java] Re: ld doesn't know about location of libjvm

Thomas Fitzsimmons fitzsim at redhat.com
Mon Oct 30 14:35:42 UTC 2006


Hi,

Braden McDaniel wrote:
> On Sun, 29 Oct 2006 14:21:29 -0500, Thomas Fitzsimmons wrote:
> 
>> Hi,
>>
>> Braden McDaniel wrote:
>>> ld seems not to know about /usr/lib[64]/gcj-4.1.1; and as such cannot 
>>> find libjvm.so without a -L flag. Is this deliberate or a bug?
>> This is deliberate.  You should be dlopen'ing libjvm.so rather than 
>> linking to it directly.  To locate it, use 
>> $JAVA_HOME/jre/lib/i386/client/libjvm.so like you would on other JVMs. 
>> java-1.4.2-gcj-compat symlinks 
>> /usr/lib/jvm/java/jre/lib/i386/client/libjvm.so to libgcj's libjvm 
>> implementation.
> 
> Fair enough; but I don't want to force my users to set JAVA_HOME. Is this
> prefix build-time discoverable?

If you're willing to require GCJ's implementation then you can count on 
libjvm.so being located at:

/usr/lib/jvm/java-1.4.2-gcj/jre/lib/$arch/client/libjvm.so

where $arch is the rpm architecture string.  To print this string for 
the target system, use:

rpm --eval "%{_arch}"

If you'd like to require any JPackage JRE then the architecture string 
may be a little different (e.g., amd64 vs. x86_64) but the location will be:

/usr/lib/jvm/jre/lib/$arch/client/libjvm.so

If you'd like to support other types of JDK installations like /opt or 
/usr/java then you'll have to do a runtime search.

Tom




More information about the fedora-devel-java-list mailing list