What is premain() and how does it get called?

The premain is a mechanism associated with the java.lang.instrument package, used for loading “Agents” which make byte-code changes in Java programs.

The mechanism is explained in the java.lang.instrument documentation.

The gist of it is that the “agent” is deployed in a jar, and that jar has a special entry in its manifest, that tells the instrumentation package where to look for the premain method. The source you quoted is supposed to be a simple agent.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)