[zeromq-dev] jzmq availability in public Maven repositories

Gabriele Svelto gabriele.svelto at gmail.com
Thu Dec 29 16:12:43 CET 2011


 Hi Daniel,

2011/12/29 Daniel Lundin <dln at eintr.org>:
> This will solve the hosting/distribution problem neatly, and we can
> focus on the tricky business - i.e how to build multi-platform jars
> w/native code.
>
> Any Java-heads around here familiar with how that works in practice?

it depends on how you want to distribute the native libraries. If the
JAR assumes that the native library is already installed, it would
just be a matter of calling System.LoadLibrary() with the correct
library for the environment you're running on within static
initialization methods (to make sure the library is loaded before any
object is instanced). Alternatively you could package the library
files for the various platforms as resources within the JAR and
automagically load the right one at runtime using System.Load() after
detecting the system you're running on.

The tricky part is really figuring out where the JAR is running
(Windows? Linux? BSD?) and then taking appropriate action. If the JAR
file is meant to be platform-specific on the other hand then there's
no need for this logic but you still need to distribute the
appropriate native library somehow (either it's pre-installed or its
packaged within the JAR).

 Gabriele



More information about the zeromq-dev mailing list