ZeroMQ ZMQ $ Socket.nativeInit()

时间:2015-12-03 15:36:45

标签: java sockets netbeans zeromq

我创建了一个测试zeromq的简单示例,但运行示例后我有一个例外:

public static void main(String[] args) {
    ZMQ.Context context = ZMQ.context(1);
    ZMQ.Socket socket = context.socket(ZMQ.PUB);
    socket.bind("tcp://*:8888");
    while (true) {
      String s = System.console().readLine();
      if (s == null) break;
      socket.send(s);
    }
    socket.close();
    context.term();
}
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.zeromq.ZMQ$Socket.nativeInit()V
    at org.zeromq.ZMQ$Socket.nativeInit(Native Method)
    at org.zeromq.ZMQ$Socket.<clinit>(ZMQ.java:435)
    at org.zeromq.ZMQ$Context.socket(ZMQ.java:365)
    at clienteadministracao.ClienteAdministracao.main(ClienteAdministracao.java:10)

有什么建议吗?我的IDE是netbeans,我使用的是ubuntu

1 个答案:

答案 0 :(得分:0)

我猜你正在使用Java绑定到本机库,要么确保.so库文件(或.dll for win)存在,要么使用JeroMQ - zeromq的完整java实现,请参见:{{ 3}}