Skip to main content

Set up a local development environment for Temporal and Java

Temporal Java SDK

To follow the Java SDK tutorials and build your own Temporal applications with Java, you'll need the JDK, the Temporal Java SDK and a Temporal development server.

Get the Java JDK

Make sure you have the Java JDK installed. These tutorials were produced using Java SE 19.0.2. You can check which version you have installed using this command:

java -version

Get the Temporal SDK for Java

While you can use any tool you like, such as Gradle or Apache Maven, to build and package your Temporal applications, our tutorials are based on Gradle.

Configure Maven

Apache Maven is a tool for build and dependency management popular with Java developers.

Install Maven using the following instructions.

Add the following lines to your Maven configuration (located in ~/.m2/settings.xml by default -- you may need to create the file):



Next, you'll configure a local Temporal cluster for development.

Set up a local Temporal development cluster

The fastest way to get a development cluster running on your local machine is to use Temporal CLI.

Temporal CLI is a tool for interacting with a Temporal Cluster from the command-line interface, but it includes a self-contained distribution of the Temporal Server and Web UI as well.

Install Temporal CLI on your local machine using the following instructions for your platform.

You can install the latest stable version with Homebrew using the following command:

brew install temporal

You can also install Temporal CLI using the installation script. Review the script and then download and install Temporal CLI with the following command:

curl -sSf | sh

To manually install Temporal CLI, download the version for your architecture:

Once you've downloaded the file, extract the downloaded archive and add the temporal binary to your PATH by copying it to a directory like /usr/local/bin.

Once you've installed Temporal CLI and added it to your PATH, open a new Terminal window and run the following command:

temporal server start-dev

This command starts a local Temporal Cluster. It starts the Web UI, creates the default Namespace, and uses an in-memory database.

  • The Temporal Server will be available on localhost:7233.
  • The Temporal Web UI will be available at http://localhost:8233.

Leave the local Temporal Cluster running as you work through tutorials and other projects. You can stop the Temporal Cluster at any time by pressing CTRL+C.

Change the Web UI port

The Temporal Web UI may be on a different port in some examples or tutorials. To change the port for the Web UI, use the --ui-port option when starting the server:

temporal server start-dev --ui-port 8080

The Temporal Web UI will now be available at http://localhost:8080.

The temporal server start-dev command uses an in-memory database, so stopping the server will erase all your Workflows and all your Task Queues. If you want to retain those between runs, start the server and specify a database filename using the --db-filename option, like this:

temporal server start-dev --db-filename your_temporal.db

When you stop and restart the Temporal Cluster and specify the same filename again, your Workflows and other information will be available.

Once you have everything installed, you're ready to build apps with Temporal on your local machine.