最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Java使用agent实现main方法之前的实例详解
时间:2022-06-29 01:16:59 编辑:袖梨 来源:一聚教程网
Java使用agent实现main方法之前的实例详解
创建Agent项目
PreMainExecutor 类,在main方法之前执行此方法
public class PreMainExecutor {
public static void premain(String agentOps, Instrumentation inst){
System.out.println("premain execute..........");
}
}
META-INF/MANIFEST.MF
Manifest-Version: 1.0 Premain-Class:test.agent.PreMainExecutor
打包成JavaAgent.jar,并放到D盘。
测试类
Test类。
public class Test {
public static void main(String[] args){
System.out.println("main..........");
}
}
执行
java -javaagent:JavaAgent.jar Test
输出
premain execute.......... main..........
相关文章
- 逆战未来枪械大全 逆战未来枪械稀有度等级与获取方式详解 07-19
- 逆战未来新手攻略 逆战未来萌新入门避坑指南 07-19
- "无醇啤酒"是完全不含酒精吗 蚂蚁庄园1月17日答案早知道 07-19
- "太常寺"是古代掌管什么事务的机构 蚂蚁新村1月16日答案 07-19
- 四川名菜"开水白菜"就是用开水炖白菜吗 蚂蚁庄园1月17日答案早知道 07-19
- 蚂蚁新村今天正确答案1.16 07-19