Skip to content

Home_EN

许杰 edited this page Sep 14, 2020 · 1 revision

Developer Guide

Environment requirement

  1. JDK[6,11]
  2. Linux/UNIX/MacOS / Windows

Install locally

  1. download source code which is a recent stable release.

  2. modify the directory address of copyfile.sh

  3. execute the commands:

    mvn clean install
    sh copyfile.sh
    

Injection

In Attach mode (dynamic injection), Easy-byte-coder depends on the jvm runtime environment variable, please make sure JAVA_HOME existed. Agent mode has no need for this setting.

Start in Attach mode:

java -Xbootclasspath/a:$JAVA_HOME/lib/tools.jar -jar bootstrap.jar

Next, select the process to inject:

image-20200818201959949

If injection successes, you should see something like:

Attaching to target JVM with PID: 91420
Attached to target JVM and loaded Java agent successfully

If you need to modify JDK source codes, like injecting JDK methods, or making many modifications when starting, you can use Agent mode.

Start in Agent mode:

-javaagent:/Users/xujie/work/ymm/jar/agent.jar=plugins=systemtime.jar

Project structure

├── zodiac-client
│   ├── agent 	agent main class, premain mothod 
│   ├── client-bootstrap  agent bootstrap,parameter parsing classLoader initialization,attach main class
│   ├── plugins	 for plugins,write codes about custom aop
│   ├── runtime-common-api 	runtime library, include ZodiacResource
│   └── traffic-handler	core codes for executing byte-code injection
└── zodiac-common  pom file

plugins development guideline

plugins development guideline

plugins annotation

plugins annotation

Use cases