[zeromq-dev] jzmq: embedding native library in JAR

Karl Ostendorf karl at ostendorf.com
Fri May 27 23:26:54 CEST 2011


Hello,

We're soliciting feedback for a proposed change to jzmq. Please read
below and vote. A decision will be made after one week.

The change is to package the native jzmq JNI library inside the JAR
file instead of installing it in the system alongside the zmq library.
The slightly modified new build process would require that the JNI
library be built before the JAR file is built. At runtime, the JNI
library is extracted to a temp file and loaded however if the library
is not found inside the JAR the code will revert to searching the
java.library.path system property. This relives users of having to
mess around with java.library.path either by setting it manually or by
making sure that the JNI library is installed into one of the
predefined locations. A couple other projects that use JNI do this as
well perhaps most notably the JDBC driver for sqlite.

Besides not having to set java.library.path the new build process also
ensures that the JNI library remains in sync with the Java code as the
two pieces must now be built at the same time. It also allows JARs to
be built that contain JNI binaries for multiple platforms (they are
stored in the JAR by arch/os). A possible drawback is that such JARs
might not contain a binary for a user's particular platform or not be
version compatible - a problem that might be hard to diagnose - and
yet easy to fix by simply building it from scratch on the target
platform.

Finally, this is only a change in the packaging of the artifacts, the
API remains unchanged. Any feedback would be welcome.

Regards.

Karl Ostendorf
http://ostendorf.com



More information about the zeromq-dev mailing list