[fedora-java] JNI packaging guidelines for optional native sub-package

Christopher ctubbsii at apache.org
Wed Jun 4 21:15:25 UTC 2014


Hello all,

I'm working on packaging a jar which includes a java-only
implementation, and optionally loads [System.load()] if configured to
do so and the shared library is available.

The actual (arch-dependent) shared library is provided in a separate
sub-package (because it's optional). This means that technically, the
jar can be noarch. Therefore, it makes much more sense to use the
System.loadLibrary() call rather than enforce arch-dependent paths.

The JNI packaging guidelines seem to written with the assumption that
the package which includes the JNI jar also includes the .so, but
that's not the case here, since the .so is optional and provided in a
separate arch-dependent sub-package.

What is the right packaging procedure here? I'm inclined to think that
using System.loadLibrary() is appropriate in these circumstances, and
that the jar should be placed in the normal %{_javadir}/%{name} rather
than the %{_jnidir} area, since it's technically noarch, and the JNI
features are optional.

--
Christopher L Tubbs II
http://gravatar.com/ctubbsii


More information about the java-devel mailing list