Disallowing the dynamic loading of agents by default (revised)
michael.rasmussen at zeroturnaround.com
Mon Apr 10 09:48:23 UTC 2017
On 10 April 2017 at 00:04, <mark.reinhold at oracle.com> wrote:
> Okay, so how about this revised proposal:
> - Define a new JAR-file manifest attribute, `Launcher-Agent-Class`.
> If this attribute is present in the manifest of an executable JAR
> file then the `agentmain` method of the specified class will be
> invoked prior to invoking the `main` method of the application.
> The JAR file will, effectively, be loaded also as a dynamic agent.
> This will allow `java -jar foo.jar` to be used in place of the more
> verbose `java -javaagent:foo.jar -jar foo.jar`.
> - Mark
I think that is a better solution, also more backwards compatible, as
it won't cause agents to unexpectedly start from existing jar files
(as others also have pointed out in this thread).
More information about the jigsaw-dev