简体   繁体   中英

Use -javaagent without packaging agent into a jar

Is it possible to run java -javaagent:myagent.jar some.package.Main without having agent packaged to a jar? Something like java agent.MyAgent some.package.Main

I have a source code for an agent and would like to be able to debug it and later change it so it is not needed to use -javaagent at all but instead select some.package.Main to execute through GUI.

BTrace is able to connect to a running process using PID or connect to a process using -javaagent . I'm looking for something similar to first approach (using PID), but so I can start a process from scratch as well.

在Java 6中,您可以使用Attach API以编程方式加载代理程序(不使用-javaagent ),但仍需要将代理程序打包为jar。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM