HOWTO: Use the Runtime Java API

Updated: March 18, 2024

This page explains how to use the Nuxeo Java API.

Java Services

The Nuxeo Platform contains a built-in notion of service. Services are Java interfaces exposed and implemented by a Component.

From within a Nuxeo Runtime aware context, you can access a service locally (in the same JVM) by simply looking up its interface with Framework#getService(T):

import org.nuxeo.runtime.api.Framework;


RelationManager rm = Framework.getService(RelationManager.class)

This service will be a singleton in the application. Once retrieved, you can use its own API.

You can find the list of existing services on the Nuxeo Platform Explorer. You will also need to understand main Java classes, using the javadoc.

You should not cache the service instance, as it is efficient to retrieve it from the runtime, and as it would prevent proper hot-reloading. If you still chose to do so, you will need to reset this cache on hot reload, see Suppporting Hot Reload.

Typical Use Cases

You may want to use this API from:

  • An Event Listener that would do some specific things,
  • A custom operation that would use the built-in services,
  • ...