Please note that JDK 17 is required. The Temurin builds of Eclipse Adoptium are strongly recommended.
To get started with a Java project, you'll need to add the following three dependencies:
1. Hedera Java™ SDK:
Gradle:
implementation 'com.hedera.hashgraph:sdk:2.47.0-beta.1'
Maven:
<dependency>
<groupId>com.hedera.hashgraph</groupId>
<artifactId>sdk</artifactId>
<version>2.47.0-beta.1</version>
</dependency>
2. gRPC implementation (select one of the following):
Gradle:
It is automatically aligned with the
grpc-api
version Hedera™ Java SDK use.// netty transport (for high throughput applications) implementation 'io.grpc:grpc-netty-shaded'// netty transport, unshaded (if you have a matching Netty dependency already) implementation 'io.grpc:grpc-netty'// okhttp transport (for lighter-weight applications or Android) implementation 'io.grpc:grpc-okhttp'
Maven:
<!-- netty transport (for server or desktop applications) -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.64.0</version>
</dependency>
<!-- netty transport, unshaded (if you have a matching Netty dependency already) -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.64.0</version>
</dependency>
<!-- okhttp transport (for lighter-weight applications or Android) -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-okhttp</artifactId>
<version>1.64.0</version>
</dependency>
3. Simple Logging Facade for Java (select one of the following to enable or disable logs):
Gradle:
// Enable logs
implementation 'org.slf4j:slf4j-simple:2.0.9'
// Disable logs
implementation 'org.slf4j:slf4j-nop:2.0.9'
Maven:
<!-- Enable logs -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.9</version>
</dependency>
<!-- Disable logs -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>2.0.9</version>
</dependency>
To make it easier to start your Java project using the Hedera™ Java SDK, we recommend checking out the Java examples. These examples show different uses and workflows, giving you valuable insights into how you can use the Hedera platform in your projects. They will also help you explore the capabilities of the Hedera™ Java SDK and start your project confidently.