Skip to content

wkgcass/javaagent-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

javaagent-base

Dependency

<dependency>
  <groupId>io.vproxy</groupId>
  <artifactId>javaagent-base</artifactId>
  <version>1.0.0</version>
</dependency>
implementation 'io.vproxy:javaagent-base:1.0.0'

How to use

Please refer to the sample project and modify-gradle-compiler-args project.

Notes:
You must --add-exports for both your module and io.vproxy.javaagent when compiling.
You should use shadowJar to bundle all classes into one fat jar and exclude module-info.class from the fat jar.

Sample

./gradlew clean shadowJar
jshell -R-javaagent:./sample/build/libs/biginteger-agent.jar

in the jshell:

jsehll> var a = new BigInteger("1")
a ==> 1000

Additional JVM Options

Add the following JVM options for the javaagent to work:

--add-opens java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-opens java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED

About

A template project for writing a javaagent

Topics

Resources

License

Stars

Watchers

Forks

Languages