mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 21:15:56 +08:00
Add a complete load-via-injector-exe example with injection/target sources, build scripts, config and bilingual docs. Remove the old loop example and config_empty.toml. Add examples-specific .gitignore for build artifacts.
66 lines
2.6 KiB
Plaintext
66 lines
2.6 KiB
Plaintext
============================================
|
|
HowToUse
|
|
============================================
|
|
|
|
Prerequisites: Java 8+ (javac/jar for building, jps for injection)
|
|
|
|
Directory Files:
|
|
injector.exe libagent.dll libinject.dll libloader.dll - JuiceAgent runtime
|
|
config.toml - injection config
|
|
demo.jar - JAR to inject (built by build.bat)
|
|
target.jar - target JVM program (built by build.bat)
|
|
injection/ - injection source
|
|
target/ - target source
|
|
build.bat - rebuild demo.jar / target.jar
|
|
run.bat - run target JVM (target.jar)
|
|
|
|
============================================
|
|
Usage Steps
|
|
============================================
|
|
|
|
1. Build (optional)
|
|
demo.jar and target.jar are already included by default.
|
|
If you modified injection/Main.java or target/target.java, run:
|
|
build.bat
|
|
to regenerate demo.jar and target.jar in this directory.
|
|
|
|
2. Run the target JVM
|
|
Double-click run.bat (or run: java -jar target.jar). A black window
|
|
appears and prints:
|
|
[Target] I am the target JVM (PID: <PID>)
|
|
...... (once per second)
|
|
|
|
3. Inject
|
|
Double-click injector.exe, type the target PID and press Enter:
|
|
6644 target.jar
|
|
10504 jdk.jcmd/sun.tools.jps.Jps
|
|
Input PID: 6644
|
|
|
|
4. Verify
|
|
Go back to the target window. Injection succeeded if you see:
|
|
[Demo] Injection succeeded! Hello from JuiceAgent.
|
|
[Demo] Current thread: Thread-0
|
|
|
|
============================================
|
|
Config / config.toml
|
|
============================================
|
|
|
|
JarPath - JAR path to inject (default: ./demo.jar)
|
|
EntryClass - Entry class (default: Example.Main)
|
|
EntryMethod - Entry method, must be public static void run()
|
|
InjectionDir - Dependency JAR directory (only *.jar is loaded)
|
|
|
|
============================================
|
|
Troubleshooting
|
|
============================================
|
|
|
|
- "java/javac/jar is not recognized":
|
|
Install a JDK and add its bin directory to PATH.
|
|
- injector.exe reports injection failure:
|
|
Make sure the target JVM is running and the PID is correct.
|
|
- No [Demo] output appears:
|
|
The target window prints many log lines which may affect reading.
|
|
Check the [JuiceAgent JarLoader] lines to locate the cause.
|
|
If it still fails, copy the full log and submit an Issue, or paste
|
|
it directly to an AI.
|