Chapter 2. Getting started

Table of Contents

Loading liburbijava shared library
Sending URBI commands
Sending binary data.
Sending a sound

Loading liburbijava shared library

Liburbi Java is a library generated from the liburbi C++ with the tool called swig. Swig generates wrapper classes in java for all the C++ classes we want to export. It also generates JNI code to make the link between Java and the C++ library. With this in mind, you understand that in order to use the Liburbi Java, you have to somehow load the C++ JNI code in your application. We provide this C++ code in a shared library called urbijava.dll under Windows, under Linux, and liburbijava.dylib under MacOs. To load the library in your java code, use the function System.loadLibrary. For example place this call in your Main class as showed bellow:

// All liburbi classes are located in the package liburbi
import liburbi.main.UClient;
import liburbi.main.liburbi;

public class Main {

  static {

NB: The path to the library you are loading 'urbijava' must be in your path for your program to find it. On Windows make sure the 'path' environment variable contains the path to the urbijava library. On Unix make sure that your LD_LIBRARY_PATH contains the path to the urbijava library.