Files
xiaozhou233 5170d50517 Docs: update config docs to v2 schema and add config.md
- docs: add config.md documenting the v2 schema ([JuiceAgent] / [JarLoader]), key defaults and the BuiltIn / CustomJar modes

- docs: rewrite advanced.md around the JarLoader.Mode = CustomJar workflow instead of the removed JUICEAGENT_API_* environment variables

- readme: migrate the Quick Start config example from v1 to v2 and link docs/config.md, list inject-via-java-api under Examples

- examples: update inject-via-java-api HowToUse docs (.md/.txt, EN/ZH) to the v2 config
2026-10-15 20:02:32 +08:00

35 lines
1.0 KiB
Markdown

# Advanced
## Load Custom API / Directly Load Jar
JuiceAgent runs in **BuiltIn** mode by default: `libloader` registers the embedded
JuiceAgent-API jar, the agent bootstraps it, and the JarLoader module loads your JAR
and invokes its entry method.
If you don't need JuiceAgent-API — for example you want to provide your own bootstrap
and call an arbitrary class/method — set `JarLoader.Mode` to **`CustomJar`**:
```toml
[JuiceAgent]
Version = 2
[JarLoader]
Mode = "CustomJar"
JarPath = "./my-agent.jar"
EntryClass = "com.example.MyBootstrap"
EntryMethod = "start"
```
Workflow in `CustomJar` mode:
1. `libloader` attaches to the target JVM and reads `config.toml`.
2. It adds `JarPath` to the system class loader search path. JuiceAgent-API is **not** loaded.
3. It invokes `EntryClass.EntryMethod`.
`EntryMethod` must be a `public static void` method that takes no arguments.
> `JarLoader.Enabled` and `JarLoader.InjectionDir` only apply to `BuiltIn` mode; they are
> ignored in `CustomJar` mode.
See [Configuration](config.md) for the complete list of keys.