Tagged articles
4 articles
Page 1 of 1
Architect
Architect
Dec 2, 2024 · Backend Development

Mastering Java Agents: Premain vs Attach for Bytecode Manipulation

This article explains how Java agents work, compares premain and attach agents, shows how to implement entry points, use Instrumentation and Javassist to transform bytecode, provides complete code samples, packaging instructions, and demonstrates the runtime output with diagrams.

AgentAttachInstrumentation
0 likes · 17 min read
Mastering Java Agents: Premain vs Attach for Bytecode Manipulation
Code Ape Tech Column
Code Ape Tech Column
Oct 14, 2024 · Backend Development

Understanding Java Agent: Premain and Agentmain Modes with Instrumentation

This article explains the concept of Java Agent, compares it with AOP, and provides step‑by‑step implementations of both premain and agentmain modes, including Maven packaging, VM attachment, class transformation, redefinition, retransformation, and a Javassist example for method timing.

AgentmainBytecode ManipulationInstrumentation
0 likes · 17 min read
Understanding Java Agent: Premain and Agentmain Modes with Instrumentation
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Aug 7, 2024 · Backend Development

Understanding and Implementing JavaAgent for Runtime Instrumentation

This article explains the concept, architecture, and practical implementation of JavaAgent for Java runtime instrumentation, covering its role, premain method, ClassFileTransformer usage, bytecode manipulation with ASM or Javassist, and step‑by‑step guidance to build, package, and attach a JavaAgent for method execution time monitoring.

ClassFileTransformerPremain
0 likes · 10 min read
Understanding and Implementing JavaAgent for Runtime Instrumentation
Su San Talks Tech
Su San Talks Tech
May 4, 2023 · Backend Development

Unlock JVM Power: Master Java Agent Premain & Agentmain for Runtime Instrumentation

This tutorial explains Java Agent technology, compares it with AOP, and provides step‑by‑step implementations of Premain and Agentmain modes, covering agent packaging, manifest configuration, instrumentation APIs, class transformation, redefinition, retransformation, and integration with Javassist for dynamic bytecode manipulation.

AgentmainBytecode ManipulationInstrumentation
0 likes · 21 min read
Unlock JVM Power: Master Java Agent Premain & Agentmain for Runtime Instrumentation