How do I start my Java program with more than one java agent?

前端 未结 4 1123
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-30 02:50

I\'m aware of how to start a java progam with a java agent:

java -javaagent:myAgent.jar MyJavaProgram

But what if I want to add 2 or more java

4条回答
  •  孤独总比滥情好
    2021-01-30 03:32

    It would appear you can do this by using multiple arguments. From the documentation:

    On implementations with a command-line interface, an agent is started by adding this option to the command-line:

    -javaagent:jarpath[=options] 
    

    jarpath is the path to the agent JAR file. options is the agent options. This switch may be used multiple times on the same command-line, thus creating multiple agents. More than one agent may use the same jarpath. An agent JAR file must conform to the JAR file specification.

    (my emphasis)

提交回复
热议问题