ZMQ.Curve.generateKeyPair() does not work on a "standalone way". The below code-snippet throws UnsatisfiedLinkError:
import org.zeromq.ZMQ;
public class GenerateKeys {
public static void main (String[] args) {
ZMQ.Curve.KeyPair curve = ZMQ.Curve.generateKeyPair();
}
}
The reason is that the native library is not loaded: only the ZMQ class has the library-loading static initializer block but the ZMQ.Curve class does not have it. Note: In the above snippet ZMQ class does not get initialized so static initializer is not called.
Possible workaround is to force the ZMQ class to be initialized so that the static initializer block is called and native library is loaded:
import org.zeromq.ZMQ;
public class GenerateKeys {
public static void main (String[] args) {
ZMQ.getMajorVersion(); // dummy call in order to load the native library
ZMQ.Curve.KeyPair curve = ZMQ.Curve.generateKeyPair();
}
}
ZMQ.Curve.generateKeyPair() does not work on a "standalone way". The below code-snippet throws UnsatisfiedLinkError:
The reason is that the native library is not loaded: only the ZMQ class has the library-loading static initializer block but the ZMQ.Curve class does not have it. Note: In the above snippet ZMQ class does not get initialized so static initializer is not called.
Possible workaround is to force the ZMQ class to be initialized so that the static initializer block is called and native library is loaded: