javazeromqpyzmqjzmq

ZMQ - libzmq.so.3: cannot open shared object file: No such file or directory


I'm trying to embed zeroMQ in my app, I followed this guideline to install ZMQ, so till here everything works fine. I have this line of code in my app:

ZMQ.Context m_context = ZMQ.context(1);

but above line of code raise below exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/libjzmq-812339378390536247.lib: libzmq.so.3: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at org.zeromq.EmbeddedLibraryTools.loadEmbeddedLibrary(EmbeddedLibraryTools.java:136)
    at org.zeromq.EmbeddedLibraryTools.<clinit>(EmbeddedLibraryTools.java:22)
    at org.zeromq.ZMQ.<clinit>(ZMQ.java:38)
    at com.castaclip.verticals.Messenger.<init>(Messenger.java:125)
    at com.castaclip.verticals.PushMessenger.<init>(PushMessenger.java:30)
    at com.castaclip.verticals.pushserver.App.setup(App.java:60)
    at com.castaclip.verticals.pushserver.App.main(App.java:41)

The error is exactly pointing to this line.

P.S: its a little bit difficult to fully explain this question.. if you have any question plz let me know. thanks.


Solution

  • If you've successfully built libzmq and jzmq in that order, I would run:

    $ sudo ldconfig
    

    to update the system library cache. Then I would check to see if LD_LIBRARY_PATH is defined like Raffian mentioned, or set your library path explicitly to something like:

    $ java -Djava.library.path=/usr/lib:/usr/local/lib