Disallowing the dynamic loading of agents by default (revised)

mark.reinhold at oracle.com mark.reinhold at oracle.com
Wed Apr 5 23:34:21 UTC 2017

2017/4/5 10:00:13 -0700, michael.rasmussen at zeroturnaround.com:
> On 5 April 2017 at 19:15,  <mark.reinhold at oracle.com> wrote:
>> ...
>>  - Enhance the `-jar` launcher option so that if the JAR file being
>>    launched contains a `Premain-Class` attribute then it's launched
>>    as both an application and as an agent for that application.
>>    This will allow `java -jar foo.jar` to be used in place of the
>>    more verbose `java -javaagent:foo.jar -jar foo.jar` [1].
> I would propose the presence of an addition option in the manifest to
> enable/control this behavior.
> In the case of standalone agents, running them as -jar are sometimes
> used for a different purpose than running them as agents.
> For instance, in the case of JRebel, java -jar jrebel.jar is used for
> license activation/control, and should not activate the agent part.

Interesting.  Perhaps we need a `Self-Premain-Class` attribute, or some

Out of curiosity, would it do any harm in your `java -jar` case if the
agent is activated?

- Mark

More information about the jigsaw-dev mailing list