I'm trying to program with ZeroMQ on Ubuntu using the Java examples. I've successfully built ZeroMq core and Java bindings, but trying to run simple example, it just hangs indefinitely.
Here's what I've done so far, btw, I'm using JDK/JRE 1.7
, ZeroMQ 3.2.2
, and Ubuntu 12.10 64-bit
Build ZeroMQ Core Libraries
I downloaded core ZeroMQ 3.2.2 POSIX tarball from here, extracted and built according to instructions here. Configure, make, and installation all went well, no errors, I also ran ldconfig
following make
to update the system library cache. A quick look at /usr/local/lib
and the core libraries appear to have built correctly...
usr1@ubuntu:/usr/local/lib$ ls -ltr *.so
lrwxrwxrwx 1 root dev 15 Apr 1 19:31 libzmq.so -> libzmq.so.3.0.0
lrwxrwxrwx 1 root dev 16 Apr 1 20:14 libjzmq.so -> libjzmq.so.0.0.0
Build JZMQ Java Bindings
Downloaded Java bindings source from here, configured, ran make; all looks good. This creates zmq.jar
and zmq-perf.jar
; ran ldconfig
again to update library cache; moved jars to /usr/local/share/java
...
usr1@ubuntu:/usr/local/share/java$ ls -ltr
-rw-r--r-- 1 usr1 usr1 40507 Apr 1 20:14 zmq.jar
-rw-rw-r-- 1 usr1 usr1 4809 Apr 2 08:41 zmq-perf.jar
Running Example local_lat
I ran the local_lat
example detailed here using the following settings for my environment...
java -Djava.library.path=/usr/local/lib -classpath /usr/local/share/java/zmq-perf.jar:/usr/local/share/java/zmq.jar local_lat tcp://127.0.0.1:5555 1 100
Got UnsatisfiedLinkError
; fixed that by just logging in and out.
Ran again and it just hangs, no errors, nata, zilch. I removed the argument 100
from above and got the usage message from local_lat
, so I know it's finding the zmq jar files since local_lat
class resides in zmq-perf.jar
. Ran again with the above command, and it just hangs; no errors, nothing. A bit of a let down since it was quite a bit of work to get everything built.
UPDATE
See below, turns out this was a problem with how I was testing
Ok, so it turns out everything I did was correct. The core libs and Java bindings were built and installed successfully, the problem was the example...
java -Djava.library.path=/usr/local/lib -classpath /usr/local/share/java/zmq-perf.jar:/usr/local/share/java/zmq.jar local_lat tcp://127.0.0.1:5555 1 100
The local_lat
program is not a Hello World test, I thought it was, it's a bit misleading on the jzmq site, the above is a command line example, not an example to test the installation, and that was confirmed by looking at the code for local_lat
; it doesn't do anything, and certainly does not output anything which is why it appeared to just hang.
I tested ZeroMq with this code, downloaded and javac'ed it, used the above command to run it.