Can I turn off embedding the tested classes?

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Oct 26 18:01:03 UTC 2015


Hi Bill,

On 10/21/2015 10:14 PM, Smith, Bill (Tridium) wrote:
> I have a java security provider that I'm trying to benchmark. When I compile
> my benchmark classes, it also embeds the security provider classes in the
> jar. The problem is that when these classes are referenced, they fail to
> load because they are not signed with an Oracle security provider code
> signing cert. Is there a way to compile jmh so that it references the
> classes from the classpath vs having them embedded in the same jar?

I think you can hack the standard build to depend on the external JAR,
and make that JAR exempt from shading (I think <scope>provided</scope>
does that).

Then, at runtime, you will have two options:
 a) Start JMH with -cp benchmarks.jar:your-jar.jar org.openjdk.jmh.Main
 b) Mix in the external JAR with -Xbootclasspath/a:your-jar.jar -jar
benchmarks.jar (may have some implications on security managers though);

With standard JDK launcher, you would be unable to do *both* -cp and
-jar, so you'll have to resort to either (a) or (b).

HTHS,
-Aleksey




More information about the jmh-dev mailing list