> ## Documentation Index
> Fetch the complete documentation index at: https://novu-c5de82d9-docs-homepage-redesign.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Java

> Connect a Java application to Novu

Novu's Java SDK provides simple, yet comprehensive notification management, and delivery capabilities through multiple channels that you can implement using code that integrates seamlessly with your Java application.

[Explore the source code on GitHub.](https://github.com/novuhq/novu-java)

## Installation

JDK 11 or later is required.

Maven users:

```xml theme={null}
<dependency>
    <groupId>co.novu</groupId>
    <artifactId>novu-java</artifactId>
    <version>LATEST</version>
</dependency>
```

The latest version can be found [on GitHub.](https://github.com/novuhq/novu-java#sdk-installation)

Gradle users:

```groovy theme={null}
implementation 'co.novu:novu-java:LATEST'
```

Sync your project, and you should have the artifacts downloaded.

## Usage

<Tabs>
  <Tab title="US Region">
    ```java theme={null}
    package hello.world;

    import co.novu.Novu;
    import co.novu.models.components.*;
    import co.novu.models.errors.*;
    import co.novu.models.operations.EventsControllerTriggerResponse;
    import java.lang.Exception;
    import java.util.Map;

    public class Application {

        public static void main(String[] args) throws PayloadValidationExceptionDto, ErrorDto, ValidationErrorDto, Exception {

            Novu sdk = Novu.builder()
                    .secretKey("YOUR_SECRET_KEY_HERE")
                .build();

            EventsControllerTriggerResponse res = sdk.trigger()
                    .body(TriggerEventRequestDto.builder()
                        .workflowId("workflow_identifier")
                        .to(To2.of("SUBSCRIBER_ID"))
                        .payload(Map.ofEntries(
                            Map.entry("comment_id", "string"),
                            Map.entry("post", Map.ofEntries(
                                Map.entry("text", "string")))))
                        .overrides(TriggerEventRequestDtoOverrides.builder()
                            .build())
                        .actor(TriggerEventRequestDtoActor.of("<value>"))
                        .context(Map.ofEntries(
                            Map.entry("tenant", TriggerEventRequestDtoContextUnion.of("org-acme"))))
                        .build())
                    .call();

            if (res.triggerEventResponseDto().isPresent()) {
                // handle response
            }
        }
    }
    ```
  </Tab>

  <Tab title="EU Region">
    ```java theme={null}
    package hello.world;

    import co.novu.Novu;
    import co.novu.models.components.*;
    import co.novu.models.errors.*;
    import co.novu.models.operations.EventsControllerTriggerResponse;
    import java.lang.Exception;
    import java.util.Map;

    public class Application {

        public static void main(String[] args) throws PayloadValidationExceptionDto, ErrorDto, ValidationErrorDto, Exception {

            Novu sdk = Novu.builder()
                    .serverUrl("https://eu.api.novu.co")
                    .secretKey("YOUR_SECRET_KEY_HERE")
                .build();

            EventsControllerTriggerResponse res = sdk.trigger()
                    .body(TriggerEventRequestDto.builder()
                        .workflowId("workflow_identifier")
                        .to(To2.of("SUBSCRIBER_ID"))
                        .payload(Map.ofEntries(
                            Map.entry("comment_id", "string"),
                            Map.entry("post", Map.ofEntries(
                                Map.entry("text", "string")))))
                        .overrides(TriggerEventRequestDtoOverrides.builder()
                            .build())
                        .actor(TriggerEventRequestDtoActor.of("<value>"))
                        .context(Map.ofEntries(
                            Map.entry("tenant", TriggerEventRequestDtoContextUnion.of("org-acme"))))
                        .build())
                    .call();

            if (res.triggerEventResponseDto().isPresent()) {
                // handle response
            }
        }
    }
    ```
  </Tab>
</Tabs>
