Skip to main content

Set up a local development environment for Temporal and Java

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 14.0.1. You can check which version you have installed using this command:

java -version

Get the Temporal SDK for Java

You can use Gradle or Maven for your projects, although we recommend Gradle.

Configure Gradle

Gradle is a dependency management and build tool for Java projects. You'll need it installed to work with the projects in these tutorials.

You can install Gradle separately, or use IntelliJ IDEA, which comes packaged with Gradle.

Install Gradle by following the installation instructions.

Add the following lines to your Gradle configuration to configure the Temporal SDK.

implementation 'io.temporal:temporal-sdk:1.11.0' 
implementation 'io.temporal:temporal-sdk:1.12.0'test
implementation 'io.temporal:temporal-testing:1.12.0'

Configure Maven

Apache Maven is another popular Java build tool.

Install Maven following the official installation instructions.

Add the following lines to your Maven configuration:

<dependency>
<groupId>io.temporal</groupId>
<artifactId>temporal-sdk</artifactId>
<version>1.11.0</version>
</dependency>

Set up a Temporal development cluster

Download and install the Temporal development cluster locally using Docker Compose. You'll run this server in the background while you develop your applications.

You must have Docker and Docker Compose installed.

Then clone the temporalio/docker-compose repository and run docker-compose up from the root of that repository:

git clone https://github.com/temporalio/docker-compose.git
cd  docker-compose
docker-compose up

When the Temporal Cluster is running, the Temporal Web UI becomes available in your browser: localhost:8080

Review other methods in the Run a dev Cluster section in Temporal's documentation.

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