יום שישי, 9 במאי 2014

How to run ZeroMQ with Java in windows7

In order to run 0MQ with java in windows follow the following steps:
1.Compile the libzmq dll 
Capture52

Set the output lib of the libzmq project
Capture51

Don’t forget to compile for x64 Bit

The compilation result should be:
1> Creating library libzmq.lib and object libzmq.exp

 

1> libzmq.vcxproj -> H:\deleteme100\zeromq-4.0.4\builds\msvc\libzmq\../../../bin/x64/libzmq_d.dll

========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

 

2.Compile the jzmq dll.
Capture53
Set the libzmq library in the project additional dependencies
Capture54
Set the jdk and the zero mq header files pathes in the c++ include directory .
Capture55
Compile the project in x64 bit .
The output should be :

1>------ Rebuild All started: Project: jzmq, Configuration: Release x64 ------

1> The syntax of the command is incorrect.

1> Note: Some input files use or override a deprecated API.

1> Note: Recompile with -Xlint:deprecation for details.

1> Generating JNI header

1> Generating JNI header

1> Generating JNI header

1> Generating JNI header

1> Generating JNI header

1> Generating JNI header

1> Generating JNI header

1> Context.cpp

1> Poller.cpp

1>..\..\..\src\main\c++\Poller.cpp(76): warning C4244: '=' : conversion from 'jint' to 'short', possible loss of data

1> Socket.cpp

1>..\..\..\src\main\c++\Socket.cpp(266): warning C4267: 'argument' : conversion from 'size_t' to 'jsize', possible loss of data

1>..\..\..\src\main\c++\Socket.cpp(272): warning C4267: 'argument' : conversion from 'size_t' to 'jsize', possible loss of data

1>..\..\..\src\main\c++\Socket.cpp(834): warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data

1>..\..\..\src\main\c++\Socket.cpp(862): warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data

1> util.cpp

1> ZMQ.cpp

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppBuild.targets(1137,5): warning MSB8012: TargetPath(H:\deleteme101\jzmq-master\builds\msvc\x64\Release\jzmq.dll) does not match the Linker's OutputFile property value (H:\deleteme101\jzmq-master\lib\jzmq.dll). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).

1> Creating library H:\deleteme101\jzmq-master\builds\msvc\x64\Release\jzmq.lib and object H:\deleteme101\jzmq-master\builds\msvc\x64\Release\jzmq.exp

1> Generating code

1> Finished generating code

1> jzmq.vcxproj -> H:\deleteme101\jzmq-master\builds\msvc\x64\Release\jzmq.dll

1> added manifest

1> adding: org/zeromq/App.class(in = 2433) (out= 1352)(deflated 44%)

1> adding: org/zeromq/EmbeddedLibraryTools.class(in = 4442) (out= 2473)(deflated 44%)

1> adding: org/zeromq/ZContext.class(in = 2621) (out= 1333)(deflated 49%)

1> adding: org/zeromq/ZDispatcher$1.class(in = 206) (out= 161)(deflated 21%)

1> adding: org/zeromq/ZDispatcher$SocketDispatcher$1.class(in = 861) (out= 413)(deflated 52%)

1> adding: org/zeromq/ZDispatcher$SocketDispatcher$2.class(in = 2034) (out= 829)(deflated 59%)

1> adding: org/zeromq/ZDispatcher$SocketDispatcher$ZMessageBuffer.class(in = 1395) (out= 653)(deflated 53%)

1> adding: org/zeromq/ZDispatcher$SocketDispatcher.class(in = 4184) (out= 1790)(deflated 57%)

1> adding: org/zeromq/ZDispatcher$ZMessageHandler.class(in = 340) (out= 213)(deflated 37%)

1> adding: org/zeromq/ZDispatcher$ZSender.class(in = 780) (out= 436)(deflated 44%)

1> adding: org/zeromq/ZDispatcher.class(in = 2778) (out= 1254)(deflated 54%)

1> adding: org/zeromq/ZFrame.class(in = 4765) (out= 2642)(deflated 44%)

1> adding: org/zeromq/ZMQ$Context.class(in = 1262) (out= 711)(deflated 43%)

1> adding: org/zeromq/ZMQ$Error.class(in = 2545) (out= 1433)(deflated 43%)

1> adding: org/zeromq/ZMQ$Event.class(in = 1444) (out= 732)(deflated 49%)

1> adding: org/zeromq/ZMQ$Poller.class(in = 4092) (out= 2007)(deflated 50%)

1> adding: org/zeromq/ZMQ$PollItem.class(in = 1651) (out= 736)(deflated 55%)

1> adding: org/zeromq/ZMQ$Socket.class(in = 11809) (out= 4589)(deflated 61%)

1> adding: org/zeromq/ZMQ.class(in = 3529) (out= 1717)(deflated 51%)

1> adding: org/zeromq/ZMQException.class(in = 771) (out= 485)(deflated 37%)

1> adding: org/zeromq/ZMQForwarder.class(in = 1464) (out= 870)(deflated 40%)

1> adding: org/zeromq/ZMQQueue.class(in = 1860) (out= 1041)(deflated 44%)

1> adding: org/zeromq/ZMQStreamer.class(in = 424) (out= 260)(deflated 38%)

1> adding: org/zeromq/ZMsg.class(in = 10214) (out= 4286)(deflated 58%)

========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

3.Copy the generated dlls into the system 32 directory
Capture56

Note:
Copy the libzmq_d.dll into libzmq.dll

4.Add the zmq jar to your project
found in zmq-master\lib
Capture57 

5.Enjoy 0mq.

References:
http://stackoverflow.com/questions/11455588/how-to-run-zeromq-with-java

אין תגובות:

הוסף רשומת תגובה