Documentation menu

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:

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)

Real output — this example ran against the current jdx when the page was built.

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:

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

Real output — this example ran against the current jdx when the page was built.

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:

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

Real output — this example ran against the current jdx when the page was built.

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

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

Real output — this example ran against the current jdx when the page was built.

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:

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]

Real output — this example ran against the current jdx when the page was built.

4. Find things and follow the graph#

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)

Real output — this example ran against the current jdx when the page was built.

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:

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.

6. Hand it to your agent#

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

That is the whole integration — see Use with AI agents.

Where next#

Edit this page on GitHub · View as Markdown · Updated