Documentation menu

jdx search

IDE equivalent: Search everywhere

Search symbols across the workspace: types, members, packages and JDK modules. Glob by default ('*Http*Client'), --regex for regexes, bare words match case-insensitively or as camel humps (HMap finds HashMap). --kind narrows to class|interface|enum|record|annotation|method|field|package|module (default: types, packages and modules; pass method|field to scan members). --fuzzy retries a miss by Levenshtein distance. Exits 1 when nothing matches.

Usage#

jdx search [<options>] <pattern>

Example#

jdx search '*TypeAdapter*' --kind class --limit 10 --coord com.google.code.gson:gson:2.14.0
search results for '*TypeAdapter*'
  class com.google.gson.Gson$FutureTypeAdapter  gson-2.14.0.jar
  class com.google.gson.TypeAdapter  gson-2.14.0.jar
  class com.google.gson.TypeAdapter$1  gson-2.14.0.jar
  class com.google.gson.TypeAdapter$NullSafeTypeAdapter  gson-2.14.0.jar
  class com.google.gson.internal.bind.ArrayTypeAdapter  gson-2.14.0.jar
  class com.google.gson.internal.bind.ArrayTypeAdapter$1  gson-2.14.0.jar
  class com.google.gson.internal.bind.CollectionTypeAdapterFactory  gson-2.14.0.jar
  class com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter  gson-2.14.0.jar
  class com.google.gson.internal.bind.DefaultDateTypeAdapter  gson-2.14.0.jar
  class com.google.gson.internal.bind.DefaultDateTypeAdapter$1  gson-2.14.0.jar
10 of 101 results shown (--limit 101 to see more)
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#

OptionDescription
--kind=(all|type|class|interface|enum|record|annotation|object|companion|method|field|package|module)Symbol kind to search: all, type, class, interface, enum, record, annotation, method, field, package or module.
--regexTreat the pattern as a regex instead of a glob.
--fuzzyLevenshtein fallback: when nothing matches, retry within two edits.
--in=<text>Only artifacts whose label matches this glob (jar file name or JDK module).
--package=<text>Only symbols in packages matching this glob.
--limit=<int>Maximum hits shown (default 50); the rest become a truncation footer.
--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-jdkDo not include the running JDK's stdlib (included by default).
--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.
--fetchAllow 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.
--jsonEmit machine-readable JSON instead of human-readable text (same information, D-007).
--no-colorDisable ANSI colors even on a TTY (piped output is always plain).
--no-daemonForce in-process execution: do not forward this query to the background daemon even when its socket answers (PROPOSAL.md §14.1).
-h, --helpShow this message and exit

Arguments#

ArgumentDescription
<pattern>Search pattern: glob, --regex regex, or bare word.

Full help text#

Show jdx search --help
jdx search --help
Usage: jdx search [<options>] <pattern>

  Search symbols across the workspace: types, members, packages and JDK modules. Glob by default ('*Http*Client'), --regex for regexes, bare words match case-insensitively or as camel humps (HMap finds HashMap). --kind narrows to class|interface|enum|record|annotation|method|field|package|module (default: types, packages and modules; pass method|field to scan members). --fuzzy retries a miss by Levenshtein distance. Exits 1 when nothing matches.

Options:
  --kind=(all|type|class|interface|enum|record|annotation|object|companion|method|field|package|module)  Symbol kind to search: all, type, class, interface, enum, record, annotation, method, field, package or module.
  --regex                                                                                                Treat the pattern as a regex instead of a glob.
  --fuzzy                                                                                                Levenshtein fallback: when nothing matches, retry within two edits.
  --in=<text>                                                                                            Only artifacts whose label matches this glob (jar file name or JDK module).
  --package=<text>                                                                                       Only symbols in packages matching this glob.
  --limit=<int>                                                                                          Maximum hits shown (default 50); the rest become a truncation footer.
  --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).
  --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:
  <pattern>  Search pattern: glob, --regex regex, or bare word.

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

Learn more#

Guide: Reading code · All commands

View as Markdown · Updated