[zeromq-dev] Compilation Errors while compiling the source code for Java API

Sudhakar Nagireddy nagireddy.sudhakar at gmail.com
Sun Jun 6 23:21:24 CEST 2010


Thanks Martin. I was able to compile with the new Java Binding Source Code
at github. But I am unable to run the sample PublisherApp provided in the
cookbook. I would appreciate if you could help me here?

-Sudhakar

*Here's the linking error I am getting:
*
Exception in thread "main" java.lang.UnsatisfiedLinkError:
org.zeromq.ZMQ$Context.construct(I)V
        at org.zeromq.ZMQ$Context.construct(Native Method)
        at org.zeromq.ZMQ$Context.<init>(ZMQ.java:105)
        at org.zeromq.ZMQ.context(ZMQ.java:61)
        at Publisher.main(Publisher.java:6)

*Publisher.java:
*
import java.nio.* ;
import org.zeromq.* ;

class Publisher {
   public static void main(String [] args) {
      ZMQ.Context ctx = ZMQ.context(1) ;
      ZMQ.Socket s = ctx.socket(ZMQ.PUB) ;
      s.bind("tcp://lo:5555") ;
      for(long msg_id=1;;msg_id++) {
         byte msg[] = new byte [8] ;
         ByteBuffer bb = ByteBuffer.wrap(msg) ;
         bb.putLong(msg_id) ;
         s.send(msg,0) ;
      }
   }
}

*Here's the command I am using to compile:
*
javac -cp /usr/local/share/java/zmq.jar Publisher.java

*Here's the command I am using to run the Publisher:
*
java -Djava.library.path=/usr/local/lib -cp /usr/local/share/java/zmq.jar:.
Publisher
*
My LD_LIBRARY_PATH:*

LD_LIBRARY_PATH=/usr/local/lib

On Sat, Jun 5, 2010 at 9:55 AM, Martin Sustrik <sustrik at 250bpm.com> wrote:

> Hi,
>
> I've just fixed the java binding to comply with 0MQ/2.0.7.
>
> Try getting the source from github now.
>
> Martin
>
>
> Sudhakar Nagireddy wrote:
> > Hi,
> >
> > I am getting the following error while compiling the 0MQ source code for
> > Java API on Fedora Core 11 64bit arch. It cannot find the file
> > org_zeromq_ZMQ_Context.h. Does any one know how to fix this problem?
> >
> > Thanks,
> > Sudhakar
> >
> > /bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.
> > -D_REENTRANT -D_THREAD_SAFE  -I/usr/java/jdk1.6.0_18/include
> > -I/usr/java/jdk1.6.0_18/include/linux -Wall -g -O2 -MT
> > libjzmq_la-Context.lo -MD -MP -MF .deps/libjzmq_la-Context.Tpo -c -o
> > libjzmq_la-Context.lo `test -f 'Context.cpp' || echo './'`Context.cpp
> > libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE
> > -I/usr/java/jdk1.6.0_18/include -I/usr/java/jdk1.6.0_18/include/linux
> > -Wall -g -O2 -MT libjzmq_la-Context.lo -MD -MP -MF
> > .deps/libjzmq_la-Context.Tpo -c Context.cpp  -fPIC -DPIC -o
> > .libs/libjzmq_la-Context.o
> > Context.cpp:27:36: error: org_zeromq_ZMQ_Context.h: No such file or
> > directory
> > /usr/local/include/zmq.h: In function âvoid
> > Java_org_zeromq_ZMQ_00024Context_construct(JNIEnv*, _jobject*, jint,
> > jint, jint)â:
> > /usr/local/include/zmq.h:147: error: too many arguments to function
> > âvoid* zmq_init(int)â
> > Context.cpp:57: error: at this point in file
> > make[2]: *** [libjzmq_la-Context.lo] Error 1
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100606/86e1cd2a/attachment.html>


More information about the zeromq-dev mailing list