Skip to content
Public template

About

Example Java Agent for the Manipulator Library

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Example Agent

This is an example how to create a java agent for the Manipulator Library.
For usage see Manipulator repository.

Usage

There are 2 ways to load this java agent. Using the -javaagent flag on startup or using the java attach api

Using the -javaagent flag (use this in the run config for your application)


java -javaagent:YourAgentjar.jar -jar YourJarToPatch.jar

This will patch the specified jar when running the application


Using the java attach api (you will need a program which can attach the agent)

// sidenote: jvm has to support the attach api for this to work
import com.sun.tools.attach.VirtualMachine;

// the process id of the running application
String pid = "1234";

VirtualMachine vm = VirtualMachine.attach(pid);
vm.loadAgent("Your agent path");
vm.detach();

This will patch the specified jar whenever the attach api injects the agent

About

Example Java Agent for the Manipulator Library

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages