How to run ZeroMQ with Java?

♀尐吖头ヾ 提交于 2019-12-05 01:01:53

Put any dll in Windows root or Windows System32 is urgly solution, it just pull you into Dll HELL.

What you need to do is add the ZQM binary path in the System PATH.

I compiled a 64bit ZMQ & JZMQ in a hour, and here is my folder structure:

c:\ZMQ\bin  
 ---  jzmq.dll, libzmq.dll
c:\ZMQ\lib 
 ---  ZMQ.jar

here is the step:

  1. add the binray path into system enviromennt, detail steps is control panel -- system --- advance settings , and in the pop-up tab, find the 'advance' -- 'enviroment variables' --- find the 'PATH' in the 'system vairiabls' and add C:\ZMQ\bin in the value

  2. open a dos prompt, and type 'where jzmq.dll' (I am not sure if where.exe exist in XP) to confirm if it is in the PATH now.

  3. Start the Eclipse, and open your project, right click on your project name, and select in the menu 'build path -- add external archives ' choose the C:\ZMQ\lib\zMQ.jar.

All done!

In my PC, the example runs correctly.

You should copy libzmq.dll to the location pointed by java.library.path and use this:

System.loadLibrary("libzmq")

The reason is that jzmq depends on libzmq so libzmq has to be loaded first.

I've just encountered this problem as well. I found a workaround by putting the jzmq.dll and libzmq.dll into the System32 folder. I don't like this as a permanent solution, but it works for the moment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!