如何使用Java运行ZeroMQ? [英] How to run ZeroMQ with Java?

查看:429
本文介绍了如何使用Java运行ZeroMQ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Eclipse和Windows XP,我遇到一个使用Java运行ZeroMQ的问题。我已经成功安装了[我认为] 0MQ库以及Java绑定。我以前使用的指示信息位于 此处



构建了两个文件: zmq.jar jzmq.dll 。我将jar文件放在我的项目中,这样可以让代码编译好。我还将 java.library.path 设置到dll的目录中,将perf目录添加到我的项目中,并将libzmq.dll添加到我的PATH中。 (全部按照说明)。



我仍然收到以下异常,我无法修复:



异常在线程mainjava.lang.UnsatisfiedLinkError:C:\jzmq\lib\jzmq.dll:找不到依赖库



什么其他库是jzmq.dll依赖?我已经尝试放置libzmq.dll到处都没有帮助。

谢谢。

解决方案

p>将任何dll放在Windows根目录下或Windows System32是紧急解决方案,只需将其拖入Dll HELL。



您需要做的是将ZQM二进制路径添加到系统路径



我编译了64位ZMQ& JZMQ在一个小时之内,这里是我的文件夹结构:

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

这里是步骤:


  1. 将binray路径添加到系统环境中,详细步骤是
    控制面板 - 系统 - - 提前设置,在弹出的选项卡中,找到'advance' - '环境变量'---在'系统vairiabls'中找到'PATH',并在值中添加C:\ZMQ\bin


  2. 打开一个dos提示符,输入'where jzmq.dll'(我不知道XP中是否存在.exe),以确认是否在PATH现在。


  3. 启动Eclipse,打开项目,右键单击项目名称,然后在菜单build path - add external档案选择C:\ZMQ\lib\zMQ.jar。


全部完成!



在我的电脑中示例运行正常。


I'm having an issue running ZeroMQ with Java using Eclipse and Windows XP. I've successfully installed [I think] the 0MQ libraries as well as the Java bindings. The instructions I used to do that are located here.

Two files were built: zmq.jar and jzmq.dll. I placed the jar file in my project, which allowed the code to compile OK. I also set the java.library.path to the directory of the dll, added the perf directory to my project, and added libzmq.dll to my PATH. (All per the instructions).

I still get the following exception that I can't fix:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\jzmq\lib\jzmq.dll: Can't find dependent libraries

What other libraries is jzmq.dll dependent on? I've tried placing libzmq.dll everywhere but that didn't help. This is the code sample I'm trying to get working.

Thank you.

解决方案

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.

这篇关于如何使用Java运行ZeroMQ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆