Refactor: migrate config to v2 format across examples and libagent

- examples: update config.toml to the v2 schema ([JarLoader] with Mode / InjectionDir / JarPath / EntryClass / EntryMethod) for inject-via-java-api, load-via-injector-exe and retransform-class

- libagent: read JarLoader.* instead of JuiceAgent.Modules.JarLoader.*, use Config::isValid() and the new get()/getPath() accessors

- libagent: rename call_java_impl to call_static_java_method
This commit is contained in:
xiaozhou233 committed 2026-10-14 21:21:02 +08:00
1 parent eb7fd31817
commit f38a28e8b3
5 files changed
+47 -57

No files matched your search

+11 -7
View File
@@ -1,14 +1,18 @@
[JuiceAgent]
Version = 1
# See config.md for more information https://github.com/xiaozhou233/JuiceAgent/blob/main/docs/config.md
[JuiceAgent.Loader]
[JuiceAgent]
Version = 2
JuiceAgentNativeLibraryPath = ""
[JuiceAgent.Modules]
[JarLoader]
# Mode: BuiltIn, CustomJar
# BuiltIn: Use the built-in jar loader (recommended, support JuiceAgent-API ( https://github.com/xiaozhou233/JuiceAgent#juiceagent-api ))
# CustomJar: Load the Jar directly, without using JuiceAgent-API
# For more information, please refer to the documentation: https://github.com/xiaozhou233/JuiceAgent/blob/main/docs/advanced.md#load-custom-api--directly-load-jar
Mode = "BuiltIn"
[JuiceAgent.Modules.JarLoader]
Enabled = true
# InjectionDir only works when Mode is BuiltIn
InjectionDir = "./injection"
JarPath = "./demo.jar"
EntryClass = "Example.Main"
EntryMethod = "run"
EntryMethod = "run"