GitHunt
MA

marschall/jol-agent

JOL repackaged as an agent

JOL Agent Build Status Maven Central

A repackaging of JOL with the Premain-Class and Launcher-Agent headers set to get around the self-attach warnings.

Usage

<!-- the actual agent itself, only used in tests -->
<dependency>
  <groupId>com.github.marschall</groupId>
  <artifactId>jol-agent</artifactId>
  <version>0.17.1</version>
  <scope>test</scope>
</dependency>

<!--so that se get the path of the agent artifact as a property -->
<plugin>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>properties</goal>
      </goals>
    </execution>
  </executions>
</plugin>

<plugin>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <!--
        Use agent argument for surefire, requires forking.
        Latter line is for JEP 471 in JDK 23+
    -->
    <argLine>
      -javaagent:@{com.github.marschall:jol-agent:jar}
      --sun-misc-unsafe-memory-access=allow
    </argLine>
    <!-- JOL classes are to be used from the agent, not the classpath -->
    <classpathDependencyExcludes>
      <classpathDependencyExclude>com.github.marschall:jol-agent</classpathDependencyExclude>
    </classpathDependencyExcludes>
  </configuration>
</plugin>

Languages

Java100.0%

Contributors

Created January 4, 2026
Updated February 22, 2026
marschall/jol-agent | GitHunt