Problem
The Java tab on the Get Started page has two issues that prevent the quickstart from working at all.
1. javac/java commands are missing classpath setup
The docs tell users to run:
```bash
javac QuickStart.java
java QuickStart
```
This fails immediately because QuickStart.java imports com.anthropic.* JARs that javac has no knowledge of. Unlike the Python tab (which shows pip install anthropic) and the TypeScript tab (which shows npm install @anthropic-ai/sdk), the Java tab skips the dependency resolution step entirely.
The correct approach with Maven is:
```bash
mvn compile exec:java -Dexec.mainClass=QuickStart
```
Or the raw javac/java approach would require manually assembling all transitive JARs and passing them via -cp, which is impractical.
2. Version 2.20.0 does not exist on Maven Central
The Maven/Gradle snippets reference version 2.20.0, which returns a 404 from Maven Central. The latest available version as of this writing is 2.26.0.
Suggested fix
- Update the version number in the Maven/Gradle snippets to the current release
- Replace the
javac/java run step with Maven (or Gradle) instructions, consistent with how the Python and TypeScript tabs handle dependency installation
Problem
The Java tab on the Get Started page has two issues that prevent the quickstart from working at all.
1.
javac/javacommands are missing classpath setupThe docs tell users to run:
```bash
javac QuickStart.java
java QuickStart
```
This fails immediately because
QuickStart.javaimportscom.anthropic.*JARs thatjavachas no knowledge of. Unlike the Python tab (which showspip install anthropic) and the TypeScript tab (which showsnpm install @anthropic-ai/sdk), the Java tab skips the dependency resolution step entirely.The correct approach with Maven is:
```bash
mvn compile exec:java -Dexec.mainClass=QuickStart
```
Or the raw
javac/javaapproach would require manually assembling all transitive JARs and passing them via-cp, which is impractical.2. Version
2.20.0does not exist on Maven CentralThe Maven/Gradle snippets reference version
2.20.0, which returns a 404 from Maven Central. The latest available version as of this writing is2.26.0.Suggested fix
javac/javarun step with Maven (or Gradle) instructions, consistent with how the Python and TypeScript tabs handle dependency installation