[fedora-java] Shared library paths for native linker

Petr Pisar ppisar at redhat.com
Mon Jan 23 10:33:11 UTC 2012


On 2012-01-20, Andrew Haley <aph at redhat.com> wrote:
> On 09/27/2011 03:52 PM, Petr Pisar wrote:
>> I have a non-java package (pl) which links to jvm. Build scripts of pl
>> needs to locate directories with libjava.so, libjvm.so etc. and instruct
>> native linker (ld) where to find them (-L option).
>
> Do you really need to link against a particular version of java?
>
As long as non-java package will work with any version of java, then
I don't.

> Would it make sense to use /usr/lib/jvm/jre/lib/arm/ etc?  This is
> independent of JDK6, JDK7, etc.
>
It isn't. I investigated locations on different architectures with
different JDK versions and I found there is no one place where header
files and libraries reside. Even your example hardcodes archicture name
into the path. See former `pl' spec file for the mess of conditions
which has been needed before.

My approach allows to get proper paths for current JDK. It's absolutly
independent on platform, JDK version, and distribution tweaks (like
Fedora alternatives). I believe my tool works everywhere (even out side
Fedora or with manually installed JDK).

-- Petr



More information about the java-devel mailing list