Sysrepo Java bindings

When Sysrepo is to be compiled with language bindings for Java make sure relevant Java packages are present on the build machine. In Ubuntu world that would be default-jre and default-jdk packages. The sysrepo docker container comes with preinstalled Java on Ubuntu 14.04. You can find out about that in the Dockerfile

To compile the Java bindings use the cmake flag GEN_JAVA_BINDINGS.

From the docker container sysrepo/sysrepo-netopeer2:devel_20161027 you can build Java bindings with the commands.

cd /opt/dev/sysrepo
mkdir build_java
cd build_java
cmake -DGEN_JAVA_BINDINGS=true ..
make -j2

The code example used can be found here.

Now you can run the Java examples with:

cd swig/java/examples
sysrepod
netopeer2-server

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./../..
javac -cp .:./../../Sysrepo.jar javaApplicationExample.java
java -cp .:./../../Sysrepo.jar javaApplicationExample

You can watch the process in the asciinema video:

https://asciinema.org/a/88060

bindings/java (last edited 2016-10-27 17:21:30 by mnovakovic)