Has anyone had success using ZeroMQ on the roborio when programming in Java? I’m struggling to even build the java bindings of ZMQ, could anyone point me in the right direction?
Here’s something that may help:
ZeroMQ Installation
Java on Ubuntu 16.04:
JNI version:
- sudo apt_get install libzmq5 libzmq-java
- create Java project (see below for where to get example code)
- configure the Java Build Path: navigate to
/Project/properties/Java Build Path
- navigate to JRE System Library/Native Library Location
- click on Edit
- browse to /usr/lib/x86_84-linux-gnu/jni and select
(the library file that is needed is libzmq.so)
- go back and click Add External Jar
- browse to /usr/share/java
- select jzmq.Jar
pure Java version (that presumably can be copied to and run on the RoboRio)
- sudo apt_get install libjeromq-java
- create Java Project
- configure the Java Build Path
- click on Add External Jar
- browse to /usr/share/Java
- select jeromq.jar
C++ on Ubuntu 16.04:
- check to see if already installed: apt search libzmq5. if not, install it:
sudo apt-get install libzmq5 - download zmq.hpp from https://github.com/zeromq/cppzmq and copy to /usr/include
- create C++ project (see below for where to get example code)
- create corresponding cmake file CMakeLists.txt:
cmake_minimum_required (VERSION 2.8)
project(zmqserver)
add_executable(zmqserver zmqserver.cpp)
target_link_libraries(zmqserver zmq)
(the link library is actually named libzmq.so and resides in /usr/local/lib, but
cmake understands the abbreviated reference 'zmq')
Python on Ubuntu 16.04:
- sudo apt-get install libzmq5
- sudo apt-get install python-zmq
- create Python program
Where to get examples
- http://zguide.zeromq.org/page:all.
- Scroll down until you find the ‘Ask and Ye Shall Receive’ section. Choose the
language you want to see the examples in and go.
Some useful Linux commands:
- apt search libzmq : find all packages involving ‘libzmq’ available via apt-get
- sudo find / -name libzmq.so : find the directories that contain libzmq.so
- sudo find / -name jzmq.jar
- sudo find / -name jeromq.jar