Java SDK

What it does

JNAOqi is an open source project that allows you to call any NAOqi module method from Java. The call syntax is the same as in Python or .Net.

JNAOqi project contains both binary and source code that needs to be compiled with Naoqi C++ SDK.

Mastering key concepts

Please make sure to have read the NAOqi Framework section first.

The basic approach is:

  • Import com.aldebaran.proxy
  • Create an ALProxy to the module you want to use with the correct class.
  • Call a method.

This can be seen in the following example:

import com.aldebaran.proxy.ALTextToSpeechProxy;

public class SayHello {
  public static String NAO_IP = "nao.local";
  public static int NAO_PORT = 9559;

  public static void main(String[] args) {
    ALTextToSpeechProxy tts = new ALTextToSpeechProxy(NAO_IP, NAO_PORT);
    tts.say("Hello, world");

Java SDK specificities

Type mappings between C++ and Java

The underlying modules of NAOqi use C++ types. All the basic types of C++ that are used in bound methods have very similar types in Java so need no special translation.

More complex C++ types such as std::vector<type> and AL::ALValue are mapped as follows (where Variant is a custom implementation of a variant type in the com.aldebaran.proxy package)

C++ JNI Java Variant conversion
bool jbool Boolean Variant::toBool()
int jint int Variant::toInt()
float jfloat float Variant::toFloat()
string jstring String Variant::toString()
ALValue::binary jbytearray byte[] Variant::toByteArray()
vector<float> jfloatarray float[] Variant::toFloatArray()
vector<int> jintarray int[] Variant::toIntArray()
vector<string> jobjectarray String[] Variant::toStringArray()
ALValue None Variant Any conversion method


  • OpenNAO does not have a JVM so the naoqi-java-sdk (jnaoqi) only allows you to call methods from PC to the robot (real or virtual).
  • Contrary to Python or C++, you cannot subscribe to events from Java, nor create NAOqi modules.

Compiling and running the examples

Please read the Java installation guide section, then proceed to the Compiling and running the examples tutorial.