Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 956 Bytes

README.md

File metadata and controls

37 lines (28 loc) · 956 Bytes

venom

A tool to inject Java Agents into JVM at runtime.

Typically to inject an agent you have to compile it into the jar and provide it as a javaagent: attribute when starting JVM. This tool allows you to do this at runtime, without restarting the JVM.

This tool does:

  • Creates a jar for you with correct manifest attributes
  • Attaches it to the JVM
  • Schedules shutdown hook to delete the .jar after before JVM shutdown.

Usage examples:

val result = Venom.inject(MyAgent::class.java)
when (result) {
    is Either.Success -> // Injected successfully
    is Either.Left -> // Injection failed
}
val config = AgentConfiguration.new<MyAgent>(
                canRedefineClasses = false,
                canReTransformClasses = false,
                canSetNativeMethodPrefix = false)

val inject = Venom.inject(config)
when (inject) {
    is Either.Left -> // success
    is Either.Right -> // err
}