> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up Java (server-side) SDK

**Developer**

**Federal docs**

**EU docs**

**Federal docs**

> [!CAUTION]
>
> **LaunchDarkly onboarding is not available in federal environments**
>
> To learn more, read [LaunchDarkly in federal environments](https://launchdarkly.com/docs/home/infrastructure/federal).

Install and initialize the LaunchDarkly Java SDK to start evaluating feature flags in your application.

## Install the package

```xml title="XML" lines wrap theme={null}
<dependency>
  <groupId>com.launchdarkly</groupId>
  <artifactId>launchdarkly-java-server-sdk</artifactId>
  <version>7.15.0</version>
</dependency>
```

```groovy title="Gradle" lines wrap theme={null}
implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '7.15.0'
```

### Initialize the SDK

```java title="Java SDK initialization" expandable lines wrap theme={null}
import com.launchdarkly.sdk.*;
import com.launchdarkly.sdk.server.*;

public class Main {
  public static void main(String[] args) {
    LDConfig config = new LDConfig.Builder().build();

    // This is your LaunchDarkly SDK key.
    // Never hardcode your SDK key in production.
    final LDClient client = new LDClient("YOUR_SDK_KEY", config);

    if (client.isInitialized()) {
      // For onboarding purposes only we flush events as soon as
      // possible so we quickly detect your connection.
      // You don't have to do this in practice because events are automatically flushed.
      client.flush();
      System.out.println("SDK successfully initialized!");
    }
  }
}
```

> [accordion] Finding your SDK credentials
>
> You can find your server-side SDK keys, mobile keys, and client-side ID on the **SDK keys** page under **Settings**.

To learn more, read [Initialize the client](https://launchdarkly.com/docs/sdk/server-side/java#initialize-the-client) in the Java SDK reference guide.
