Re: /usr/lib/jni support in Fedora

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 29, 2014 at 7:05 AM, Florian Weimer <fweimer@xxxxxxxxxx> wrote:
As far as I can tell, currently, System.loadLibrary() is mostly unusable for Java libraries because they cannot influence the library search path.  If you want to transparently load a DSO, you need to use System.load() and hard-code the path.  This probably means patching upstream sources.

To be clear, you can use LD_LIBRARY_PATH, or -Djava.library.path to influence the search path in any launch scripts, just like you'd control the bootstrap classpath in those same scripts. By choosing to use System.loadLibrary(), instead of System.load(), the developer has already decided to defer any influence over the search path to something external, like a script (or the system's ld cache), so I've not found this to be much of a limitation. I'm sure there are arguments against doing this, but it is imprecise to say that it's not possible.
 
Debian patches the default search path so that System.loadLibrary() searches /usr/lib/jni for DSOs with native code.  This means that classes which call System.loadLibrary() just work, assuming that the Debian package installs its DSOs into /usr/lib/jni.

Forgive my ignorance, but what exactly is wrong with just using /usr/lib[64], and how does putting them in a separate directory from other system shared libraries offer any greater degree of control? It seems to me that this solution is just as good as just putting the DSOs in /usr/lib[64]. What am I missing? What's the difference?

Can we do something similar in Fedora?  We probably want /usr/lib/jni and /usr/lib64/jni, for consistency with the rest of the system.

The upstream default search path starts with "/usr/java/packages/lib/amd64" (and variants for other architectures), but this isn't mentioned in the Fedora guidelines.  I'm also not sure if we want to use this file system location because it doesn't look particularly FHS-compliant.  But the proprietary JDKs could install a symlink there so that /usr/lib{,64}/jni is searched as well.

--
Florian Weimer / Red Hat Product Security
--
java-devel mailing list
java-devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/java-devel

--
java-devel mailing list
java-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/java-devel

[Index of Archives]     [Red Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux