Skip to content

Java quickstart docs: javac/java commands don't work without classpath setup, version 2.20.0 doesn't exist #326

@JustinMifkovich

Description

@JustinMifkovich

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationsdk

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions