jdx body
IDE equivalent: Open the method
Show the body of a member: the verbatim source slice with 1-based line numbers plus provenance (artifact, file, lines). Takes a member reference (e.g. 'com.example.Point#getX()', "Gson#toJson(Object)"). An under-specified name with several overloads exits 2 with candidates. Without paired sources the query names the decompiler tasks instead of guessing. Exits 1 when the member or its sources are unknown, 2 when ambiguous, 4 when the workspace cannot be resolved.
Usage#
jdx body [<options>] <ref>Example#
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());
}
next: jdx show com.google.gson.Gson
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.
Options#
| Option | Description |
|---|---|
--context=<int> | Surrounding source lines shown each side of the member (default 0). |
--line-numbers | Prefix each shown line with its 1-based number. |
--max-lines=<int> | Maximum body lines shown (default 200); the rest become a truncation footer. |
--engine=(vineflower|javap) | Disassembly engine: vineflower forces reconstruction even when sources are paired (default serves sources, falling back to vineflower); javap shows the raw bytecode instead. |
--kotlin-mode=(psi|lexer|auto) | How to read a .kt body. psi (default) uses the compiler sidecar, then decompile. lexer brace-matches the source without the sidecar and labels provenance lexer. auto uses the sidecar when it parses, otherwise the lexer. jdx source and jdx doc stay on psi. The lexer never downloads anything. |
--with-doc | Include the member's javadoc beside the body. |
--with-signature | Prepend the resolved bytecode signature header to the body. |
--jars=<text> | Binary roots: jar files, class directories or globs (repeatable). Merge in front of the selected workspace's roots. |
-w, --workspace=<text> | Use a named workspace (see jdx ws). Explicit --jars merge in front of it. |
--no-jdk | Do not include the running JDK's stdlib (included by default). |
--release, --multi-release=<int> | Multi-release jar feature to serve, matching javap --multi-release. The highest META-INF/versions/N at or below N wins; 8 selects base entries only. Omitted, the running JDK feature is used. Values below 8 are a usage error. An explicit value stays in-process; the warm daemon keeps the running JDK. |
--coord=<text> | Maven coordinate root group:artifact:version (repeatable). Resolved from ~/.gradle/caches and ~/.m2 first; with --fetch, downloaded from Maven repositories into <cache-dir>/m2 with checksum verification. Merges in front of the workspace. |
--repo=<text> | Maven repository base URL for --coord fetches (repeatable, e.g. --repo https://repo.example.com/maven2). Tried in flag order before Maven Central, which stays last as the fallback. Must be an http(s) URL. |
--fetch | Allow downloading --coord artifacts (and their -sources.jar) from Maven repositories (Central by default, --repo to add mirrors). Without it, coordinates resolve from the local caches only. |
--json | Emit machine-readable JSON instead of human-readable text (same information, D-007). |
--no-color | Disable ANSI colors even on a TTY (piped output is always plain). |
--no-daemon | Force in-process execution: do not forward this query to the background daemon even when its socket answers (PROPOSAL.md §14.1). |
-h, --help | Show this message and exit |
Arguments#
| Argument | Description |
|---|---|
<ref> | Member reference to show the body of (full or short form). |
Full help text#
Show jdx body --help
jdx body --help
Usage: jdx body [<options>] <ref>
Show the body of a member: the verbatim source slice with 1-based line numbers plus provenance (artifact, file, lines). Takes a member reference (e.g. 'com.example.Point#getX()', "Gson#toJson(Object)"). An under-specified name with several overloads exits 2 with candidates. Without paired sources the query names the decompiler tasks instead of guessing. Exits 1 when the member or its sources are unknown, 2 when ambiguous, 4 when the workspace cannot be resolved.
Options:
--context=<int> Surrounding source lines shown each side of the member (default 0).
--line-numbers Prefix each shown line with its 1-based number.
--max-lines=<int> Maximum body lines shown (default 200); the rest become a truncation footer.
--engine=(vineflower|javap) Disassembly engine: vineflower forces reconstruction even when sources are paired (default serves sources, falling back to vineflower); javap shows the raw bytecode instead.
--kotlin-mode=(psi|lexer|auto) How to read a .kt body. psi (default) uses the compiler sidecar, then decompile. lexer brace-matches the source without the sidecar and labels provenance lexer. auto uses the sidecar when it parses, otherwise the lexer. jdx source and jdx doc stay on psi. The lexer never downloads anything.
--with-doc Include the member's javadoc beside the body.
--with-signature Prepend the resolved bytecode signature header to the body.
--jars=<text> Binary roots: jar files, class directories or globs (repeatable). Merge in front of the selected workspace's roots.
-w, --workspace=<text> Use a named workspace (see jdx ws). Explicit --jars merge in front of it.
--no-jdk Do not include the running JDK's stdlib (included by default).
--release, --multi-release=<int> Multi-release jar feature to serve, matching javap --multi-release. The highest META-INF/versions/N at or below N wins; 8 selects base entries only. Omitted, the running JDK feature is used. Values below 8 are a usage error. An explicit value stays in-process; the warm daemon keeps the running JDK.
--coord=<text> Maven coordinate root group:artifact:version (repeatable). Resolved from ~/.gradle/caches and ~/.m2 first; with --fetch, downloaded from Maven repositories into <cache-dir>/m2 with checksum verification. Merges in front of the workspace.
--repo=<text> Maven repository base URL for --coord fetches (repeatable, e.g. --repo https://repo.example.com/maven2). Tried in flag order before Maven Central, which stays last as the fallback. Must be an http(s) URL.
--fetch Allow downloading --coord artifacts (and their -sources.jar) from Maven repositories (Central by default, --repo to add mirrors). Without it, coordinates resolve from the local caches only.
--json Emit machine-readable JSON instead of human-readable text (same information, D-007).
--no-color Disable ANSI colors even on a TTY (piped output is always plain).
--no-daemon Force in-process execution: do not forward this query to the background daemon even when its socket answers (PROPOSAL.md §14.1).
-h, --help Show this message and exit
Arguments:
<ref> Member reference to show the body of (full or short form).Real output — this example ran against the current jdx when the page was built.
Learn more#
Guide: Reading code · All commands
See also: Find a Mixin target in Minecraft · Read a Kotlin library API from a compiled jar
Related commands: jdx signature · jdx callers · jdx calls