> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-update-1770920925-e15dbde.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How to set up a Java application

This guide covers the basic configuration files needed to use the LangSmith Java SDK in your application.

## Specify dependencies

Dependencies can be specified using either Maven or Gradle. The LangSmith Java SDK requires **Java 8 or later**.

### Maven

Add the LangSmith Java SDK to your `pom.xml`:

```xml theme={null}
<dependency>
  <groupId>com.langchain.smith</groupId>
  <artifactId>langsmith-java</artifactId>
  <version>0.1.0-alpha.19</version>
</dependency>
```

### Gradle

Add the LangSmith Java SDK to your `build.gradle.kts` or `build.gradle`:

```kotlin theme={null}
implementation("com.langchain.smith:langsmith-java:0.1.0-alpha.19")
```

Example file directory:

```bash theme={null}
my-app/
└── build.gradle.kts # Gradle dependencies
```

## Specify environment variables

The LangSmith Java SDK configures itself through environment variables. See the [Environment Variables reference](/langsmith/env-var) to configure additional variables for tracing.

Example `.env` file:

```bash theme={null}
# Required: LangSmith API Key
LANGSMITH_API_KEY=lsv2_...

# Optional: Custom LangSmith API endpoint
# LANGSMITH_ENDPOINT=https://api.smith.langchain.com

# Optional: Organization and tenant settings
# LANGSMITH_ORGANIZATION_ID=your-org-id
# LANGSMITH_TENANT_ID=your-tenant-id
```

The SDK will automatically read these environment variables when you initialize the client using `LangsmithOkHttpClient.fromEnv()`.

Example file directory:

```bash theme={null}
my-app/
├── pom.xml # or build.gradle.kts
└── .env # environment variables
```

## Next

After you configure your Java application with the LangSmith SDK, you can:

* [Log traces to a specific project](/langsmith/log-traces-to-project)
* [Track costs and usage](/langsmith/cost-tracking)
* [Create and manage datasets](/langsmith/manage-datasets-programmatically)
* [Query and export traces](/langsmith/export-traces)
* [Manage prompts programmatically](/langsmith/manage-prompts-programmatically)

***

<Callout icon="pen-to-square" iconType="regular">
  [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/setup-java.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
</Callout>

<Tip icon="terminal" iconType="regular">
  [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
</Tip>
