The Jigsaw EA builds [1] have been refreshed to include some of the
pieces in this proposal, specifically:
- If an executable JAR contains a java agent then it will be started by
`java -jar` when the main manifest has the `Launcher-Agent-Class`
attribute. The entry point that is invoked is the `agentmain` method. In
the HotSpot implementation then all Can-XXX attributes can be used. The
Boot-Class-Path attribute can be used too, say for cases where the
executable JAR brings a helper JAR with classes that need to be visible
to the boot loader (when instrumenting classes in modules defined to the
boot loader for example).
The `Launcher-Agent-Class` attribute will be ignored when on small
run-time image that doesn't include the `java.instrument` module.
One other point to mention is that the proposal (and implementation)
does not include any built-in support for providing options to the
agent. If configuration is needed then one simple approach is to include
a resource file in the JAR file with the options and have the agent read
that with Class.getResourceXXX.
- The attach API disallows attaching to the current process. For now,
the "jdk.attach.allowAttachSelf" system property can be used for cases
where the tool and target VM are the same process. The system property
is set on the command line with `-Djdk.attach.allowAttachSelf` or
`-Djdk.attach.allowAttachSelf=true`. It will be ignored on JDK 8 and older.
The builds don't have the Serguei Spitsyn's patch for
EnableDynamicAgentLoading yet. We're re-align that with the revised
proposal so that there are builds available to try out in the coming days.
-Alan
[1] https://jdk9.java.net/jigsaw/