# jdx literals

IDE equivalent: Search string constants (LDC / ConstantValue / .properties)

Search string constants across the workspace's bytecode roots: every LDC string load and String field ConstantValue whose value matches <text>, plus every .properties key/value that matches (substring by default). --regex treats <text> as a Java regex; --ignore-case folds substring matches (put (?i) in a --regex pattern). --in/--exclude filter by artifact label; --limit caps rows (default 50). Exits 1 when nothing matches.

## Usage

```text
jdx literals [<options>] <text>
```

## Example

```console
$ jdx literals 'com.google.gson' --coord com.google.code.gson:gson:2.14.0 --limit 5 --no-jdk
literals matching 'com.google.gson'
gson-2.14.0.jar (2)
  ldc com.google.gson.internal.bind.TypeAdapters#javaTimeTypeAdapterFactory()  "com.google.gson.internal.bind.JavaTimeTypeAdapters"  TypeAdapters.java:951
  ldc com.google.gson.internal.reflect.ReflectionHelper#getInaccessibleTroubleshootingSuffix(java.lang.Exception)  "to module com.google.gson"  ReflectionHelper.java:51
```

## Options

| Option | Description |
|---|---|
| `--regex` | Treat <text> as a Java regex matched against each constant value. |
| `--ignore-case` | Case-insensitive substring match (ignored under --regex; use (?i) there). |
| `--in=<text>` | Only artifacts whose label matches this glob (jar file name, JDK module or class-dir name). |
| `--exclude=<text>` | Skip artifacts whose label matches this glob. |
| `--limit=<int>` | Maximum literals 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

| Argument | Description |
|---|---|
| `<text>` | Substring (or --regex pattern) to find in string constants. |

## Full help text

```console
$ jdx literals --help
Usage: jdx literals [<options>] <text>

  Search string constants across the workspace's bytecode roots: every LDC string load and String field ConstantValue whose value matches <text>, plus every .properties key/value that matches (substring by default). --regex treats <text> as a Java regex; --ignore-case folds substring matches (put (?i) in a --regex pattern). --in/--exclude filter by artifact label; --limit caps rows (default 50). Exits 1 when nothing matches.

Options:
  --regex                 Treat <text> as a Java regex matched against each constant value.
  --ignore-case           Case-insensitive substring match (ignored under --regex; use (?i) there).
  --in=<text>             Only artifacts whose label matches this glob (jar file name, JDK module or class-dir name).
  --exclude=<text>        Skip artifacts whose label matches this glob.
  --limit=<int>           Maximum literals 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:
  <text>  Substring (or --regex pattern) to find in string constants.
```

## Learn more

Guide: [Usages, hierarchy & calls](https://mohammadmd1383.github.io/jdx/docs/navigating-code/) · [All commands](https://mohammadmd1383.github.io/jdx/docs/reference/)
