Make sure you don't have old versions of the DLL and JAR files lying around. 
Then, put your DLL file in the System32 directory, put your JAR file in the 
same directory where your main program is, adjust CLASSPATH accordingly and try 
running your program. If it works, you can start slowly unwinding this setup 
until you have everywhere placed wherever you want to.

HTH and best regards.

--
Gonzalo Diethelm
DCV Chile

From: [email protected] 
[mailto:[email protected]] On Behalf Of Glenn LeMoine
Sent: Wednesday, January 18, 2012 2:52 PM
To: [email protected]
Subject: [zeromq-dev] Fwd: FW: Java Binding



Guys,

I've successfully downloaded and compiled libzmq.dll as well as jzmq.dll in 
VS2008 on Windows XP 32bit. I've xcopied the libraries as well as the jars to 
C:\zmq\bin and C:\zmq\java respectively. I've added 
java.library.path=.;C:\zmq\java to my system variables. I've added ;C:\zmq\java 
to my classpath and I've added C:\zmq\bin to my Path. After several iterations 
on the command line, it seems that the zmq.jar cannot locate jzmq.dll as i get 
the following exception:

C:\Devel\zmq\zeromq-jzmq-4bdf011\perf>java local_lat 
tcp://127.0.0.1:5555<http://127.0.0.1:5555> 1 100
Exception in thread "main" java.lang.NoClassDefFoundError: org/zeromq/ZMQ
        at local_lat.main(local_lat.java:36)
Caused by: java.lang.ClassNotFoundException: org.zeromq.ZMQ
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)

I then tried copying the .dlls (libzmq,jzmq) into the C:\Windows\System32 
directory as well as to the C:\Devel\zmq\zeromq-jzmq-4bdf011\perf directory to 
no avail. On the latest attempt I opened up the project in eclipse and added 
the .dll as a native library. On this iteration, the zmq.jar successfully found 
the jzmq.dll as evidenced by successfully creating a context:


ZMQ.Context ctx = ZMQ.context (1);
ZMQ.Socket s = ctx.socket (ZMQ.REP);

        //  Add your socket options here.
        //  For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
s.bind (bindTo);

Unfortunately, the thread dies when it reaches
for (int i = 0; i != roundtripCount; i++) {
            byte [] data = s.recv (0);

on ZMQ.context.recieve with no exception.

I'd appreciate help with the following two problems
1) Correctly declaring system and environment variables to run jzmq from the 
command line.
2) Diagnosing why the thread is dying when it reaches s.recv(0) (I haven't 
looked as of yet, but my hunch is that s.recv calls into libzmq.dll and i 
currently have it configured incorrectly.
Many Thanks

G


_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to