Apache Jackrabbit : InteractiveCommandLine

This document describes how to

  • Execute a command line app in an interactive mode to change a JackRabbit Repository.
  • Execute specific commands on interactive mode. For example, how to create a new workspace.

Feel free to make changes to this document.

Access the repository from the command line interface

Since version 2.1, jcr-commands (contrib) has been integrated to JackRabbit Standalone (https://issues.apache.org/jira/browse/JCR-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel).

So, Jackrabbit standalone may be used to run in an interactive mode and allow the admin to change the repository.

This feature is most valuable to allow the admin to create new workspaces, add specific nodes and others easily.

To execute Jackrabbit standalone in interactive mode, it may be executed specifying parameter -i or --cli.

For example:

java -Xmx256m -jar jackrabbit-standalone-2.2.4.jar --cli file:///scratch/jcr/repository

Notice that the parameter --cli accepts a valid URI to access the repository. It invokes JcrUtils.getRepository(URI) from jackrabbit-commons to get the access to the repository. See the documentation of this method in jackrabbit-commons for more detail.

See the documentation of the repository implementation you want to use for whether it supports this repository URI convention and for what the repository URI should look like. For example, Jackrabbit 2.0 supports the following types of repository URIs:

A remote repository connection using SPI2DAVex with the given URL. See the jackrabbit-jcr2dav component for more details. file://...
An embedded Jackrabbit repository located in the given directory. See the jackrabbit-core component for more details. jndi:...
JNDI lookup for the named repository. See the JndiRepositoryFactory class for more details.

The next examples are valid:

java -Xmx256m -jar jackrabbit-standalone-2.2.4.jar --cli jndi:jcr/Repository

After executing standalone with --cli parameter, you may execute jcr commands in an interactive mode. Execute


to list the available commands and

  help [command]

for details in a specific command.

For example, you may execute the following commands:

Login using the user and password in the repository:

login user password

create an additional ``workspace1'' workspace:

createWorkspace workspace1