mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
Docs: Update Inject.md
This commit is contained in:
1 parent
10ec330480
commit
396ec1a96f
2 files changed
+27
-19
No files matched your search
@@ -170,25 +170,7 @@ You can also pass arguments directly: `injector.exe <pid> <libloader.dll path> [
|
||||
|
||||
#### Method B: Use JNI to call `inject`
|
||||
|
||||
Create `cn/xiaozhou233/juiceagent/injector/InjectorNative.java` in your project:
|
||||
|
||||
```java
|
||||
package cn.xiaozhou233.juiceagent.injector;
|
||||
|
||||
public class InjectorNative {
|
||||
public native boolean inject(int pid, String path);
|
||||
public native boolean inject(int pid, String path, String configDir);
|
||||
}
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```java
|
||||
System.load("<path-to-libinject.dll>");
|
||||
InjectorNative injectorNative = new InjectorNative();
|
||||
|
||||
injectorNative.inject(<pid>, "<path-to-libloader.dll>", "<path-to-config-directory>");
|
||||
```
|
||||
See [Inject](doc/Inject.md)
|
||||
|
||||
### 5. Done
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Inject Method
|
||||
|
||||
## Method A: Use `injector.exe`
|
||||
Run `injector.exe` from `YourDir`.
|
||||
|
||||
```text
|
||||
<jps output>
|
||||
Input PID:
|
||||
```
|
||||
|
||||
Enter the PID of the target JVM process and press Enter.
|
||||
|
||||
## Method B: Use JNI to call `inject`
|
||||
Download the JuiceAgent-JavaInjector-x.x-xxxx.jar from [here](https://github.com/xiaozhou233/JuiceAgent-JavaInjector/releases).
|
||||
|
||||
Add JuiceAgent-JavaInjector-x.x-xxxx.jar to your classpath.
|
||||
|
||||
Example:
|
||||
|
||||
```java
|
||||
import cn.xiaozhou233.juiceagent.injector.Injector;
|
||||
|
||||
System.load("<path-to-libinject>");
|
||||
|
||||
Injector.inject(<pid>, "<path-to-libloader>", "<path-to-config-directory>");
|
||||
```
|
||||
Reference in new issue
Block a user