mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
Feat: add java-system-load test with copy-and-build and run scripts
This commit is contained in:
1 parent
092110672a
commit
78160a33a9
5 files changed
+73
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Loader {
|
||||
public static void main(String[] args) {
|
||||
System.load(new File("./libinject.dll").getAbsolutePath());
|
||||
System.out.println("Loaded libinject.dll");
|
||||
System.out.println("====================================");
|
||||
System.load(new File("./libloader.dll").getAbsolutePath());
|
||||
System.out.println("Loaded libloader.dll");
|
||||
System.out.println("====================================");
|
||||
System.load(new File("./libagent.dll").getAbsolutePath());
|
||||
System.out.println("Loaded libagent.dll");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
[JuiceAgent]
|
||||
Version = 1
|
||||
|
||||
[JuiceAgent.Loader]
|
||||
# Path to JuiceAgent-API jar, leave empty to use the built-in API
|
||||
JuiceAgentAPIJarPath = ""
|
||||
# Path to libagent.dll, default is "./libagent.dll"
|
||||
JuiceAgentNativeLibraryPath = ""
|
||||
|
||||
[JuiceAgent.Modules]
|
||||
|
||||
[JuiceAgent.Modules.JarLoader]
|
||||
Enabled = true
|
||||
# Directory containing dependency JARs to load into the JVM (put your deps here)
|
||||
InjectionDir = "./injection"
|
||||
# Path to the injection JAR to be loaded
|
||||
JarPath = "./demo.jar"
|
||||
# Entry class to be executed after loading the JAR
|
||||
EntryClass = "Example.Main"
|
||||
# Entry method, must be: public static void run()
|
||||
EntryMethod = "run"
|
||||
@@ -0,0 +1,23 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
|
||||
set "SRC=..\..\build\bin"
|
||||
|
||||
echo [INFO] Copying build artifacts from "%SRC%" ...
|
||||
xcopy /Y "%SRC%\libagent.dll" .\ >nul
|
||||
xcopy /Y "%SRC%\libinject.dll" .\ >nul
|
||||
xcopy /Y "%SRC%\libloader.dll" .\ >nul
|
||||
echo [OK] Artifacts copied.
|
||||
|
||||
if not exist build mkdir build
|
||||
|
||||
javac -d build Loader.java
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Build failed.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [OK] Build succeeded: build\Loader.class
|
||||
|
||||
endlocal
|
||||
@@ -0,0 +1,11 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
|
||||
java -cp build Loader
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Run failed.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
endlocal
|
||||
Reference in new issue
Block a user