# Quickstart

Five minutes, two classpaths: the JDK (no setup at all) and a library pulled by its Maven coordinate. Every output below is real — it was produced by running the command when this page was built.

## 1. Ask about the JDK — zero setup

The running JDK is always on the classpath, so this works straight after installing:

```console jdx-generated
$ jdx members java.util.HashMap --limit 5
members of java.util.HashMap
constructors declared on java.util.HashMap:
  constructor public HashMap()
  constructor public HashMap(int initialCapacity)
  constructor public HashMap(int initialCapacity, float loadFactor)
  constructor public HashMap(java.util.Map<? extends K, ? extends V> m)
methods declared on java.util.HashMap:
  method public V compute(K key, java.util.function.BiFunction<? super K, ? super V, ? extends V> remappingFunction)
+ 7 from java.lang.Object (--from java.lang.Object to expand)
5 of 53 members shown (--limit 53 to see more)
source: java.base (jrt)
```

The footer says what was cut and which `--limit` shows the rest. The `source:` line says where
the answer came from.

Now read one method — only that method:

```console jdx-generated
$ jdx body 'java.util.HashMap#get(java.lang.Object)'
java.util.HashMap#get(java.lang.Object)
  source: src.zip · java.base/java/util/HashMap.java:562-565
    public V get(Object key) {
        Node<K,V> e;
        return (e = getNode(key)) == null ? null : e.value;
    }
next: jdx show java.util.HashMap
```

Always quote references in a shell: `#`, `(` and `$` are shell syntax. When there are no
sources, jdx decompiles and marks the output `⚠ reconstructed`.

## 2. Ask about a library by Maven coordinate

`--coord` resolves a library from your local Gradle and Maven caches; `--fetch` allows
downloading it (and its `-sources.jar`) from Maven Central once:

```console jdx-generated
$ jdx show com.google.gson.Gson --coord com.google.code.gson:gson:2.14.0 --fetch
class com.google.gson.Gson
  public final class Gson
  extends java.lang.Object
  members: 2 constructors, 33 methods, 26 fields
warning MULTI_RELEASE_VARIANT: multi-release gson-2.14.0.jar serves version-specific variants for this JDK (21)
source: gson-2.14.0.jar (bytecode)
next: jdx members com.google.gson.Gson --inherited
```

With sources available, `body` shows the real source with its file and line range:

```console jdx-generated
$ jdx body 'com.google.gson.Gson#toJson(Object)' --coord com.google.code.gson:gson:2.14.0
com.google.gson.Gson#toJson(java.lang.Object)
  source: gson-2.14.0-sources.jar · com/google/gson/Gson.java:542-547
  public String toJson(Object src) {
    if (src == null) {
      return toJson(JsonNull.INSTANCE);
    }
    return toJson(src, src.getClass());
  }
warning MULTI_RELEASE_VARIANT: multi-release gson-2.14.0.jar serves version-specific variants for this JDK (21)
next: jdx show com.google.gson.Gson
```

## 3. Let it refuse to guess

`toJson` has several overloads. jdx will not pick one for you — it exits `2` and prints every
candidate as a ready-to-paste reference:

```console jdx-generated
$ jdx body 'com.google.gson.Gson#toJson' --coord com.google.code.gson:gson:2.14.0
ambiguous: 8 candidates for com.google.gson.Gson#toJson
  com.google.gson.Gson#toJson(com.google.gson.JsonElement)
  com.google.gson.Gson#toJson(com.google.gson.JsonElement, com.google.gson.stream.JsonWriter)
  com.google.gson.Gson#toJson(com.google.gson.JsonElement, java.lang.Appendable)
  com.google.gson.Gson#toJson(java.lang.Object)
  com.google.gson.Gson#toJson(java.lang.Object, java.lang.Appendable)
  com.google.gson.Gson#toJson(java.lang.Object, java.lang.reflect.Type)
  com.google.gson.Gson#toJson(java.lang.Object, java.lang.reflect.Type, com.google.gson.stream.JsonWriter)
  com.google.gson.Gson#toJson(java.lang.Object, java.lang.reflect.Type, java.lang.Appendable)
hint: re-run with one of the refs above
[exit 2]
```

## 4. Find things and follow the graph

```console jdx-generated
$ jdx search '*Json*Reader*' --coord com.google.code.gson:gson:2.14.0
search results for '*Json*Reader*'
  class com.google.gson.internal.JsonReaderInternalAccess  gson-2.14.0.jar
  class com.google.gson.internal.bind.JsonTreeReader  gson-2.14.0.jar
  class com.google.gson.internal.bind.JsonTreeReader$1  gson-2.14.0.jar
  class com.google.gson.internal.bind.JsonTreeReader$2  gson-2.14.0.jar
  class com.google.gson.stream.JsonReader  gson-2.14.0.jar
  class com.google.gson.stream.JsonReader$1  gson-2.14.0.jar
warning MULTI_RELEASE_VARIANT: multi-release gson-2.14.0.jar serves version-specific variants for this JDK (21)
$ jdx hierarchy com.google.gson.JsonElement --coord com.google.code.gson:gson:2.14.0
hierarchy of 'com.google.gson.JsonElement'
  supertypes
    extends java.lang.Object  java.base
  subtypes in workspace (4)
    class com.google.gson.JsonArray  gson-2.14.0.jar
    class com.google.gson.JsonNull  gson-2.14.0.jar
    class com.google.gson.JsonObject  gson-2.14.0.jar
    class com.google.gson.JsonPrimitive  gson-2.14.0.jar
warning MULTI_RELEASE_VARIANT: multi-release gson-2.14.0.jar serves version-specific variants for this JDK (21)
```

## 5. Name your classpath once

Typing `--coord` on every command gets old. A named workspace stores the classpath; every
command (and the MCP server, daemon and HTTP API) can reuse it:

```bash
jdx ws create gson --coord com.google.code.gson:gson:2.14.0
jdx -w gson usages com.google.gson.TypeAdapter
jdx ws use gson        # make it the default for this machine
```

Inside a Gradle or Maven project you often need nothing at all: jdx discovers the project's
sources and dependency jars from the working directory. See
[Classpath \& workspaces](https://mohammadmd1383.github.io/jdx/docs/classpath/).

## 6. Hand it to your agent

```bash
jdx setup --agent claude-code --scope project   # or cursor, codex, opencode, copilot, antigravity, …
```

That is the whole integration — see [Use with AI agents](https://mohammadmd1383.github.io/jdx/docs/ai-agents/).

## Where next

- [Symbol references](https://mohammadmd1383.github.io/jdx/docs/symbol-references/) — every way to name a class or member.
- [Reading code](https://mohammadmd1383.github.io/jdx/docs/reading-code/) and [Usages, hierarchy \& calls](https://mohammadmd1383.github.io/jdx/docs/navigating-code/).
- The [command catalogue](https://mohammadmd1383.github.io/jdx/docs/reference/).
