Forking with mvn exec:java
Aleksey Shipilev
aleksey.shipilev at oracle.com
Mon Jul 28 01:01:07 UTC 2014
Hi,
On 07/27/2014 06:06 AM, Guillaume Drouet wrote:
> java.lang.NoClassDefFoundError: org/openjdk/jmh/runner/ForkedMain
> Caused by: java.lang.ClassNotFoundException:
So it looks like jmh-core is not on classpath, which is weird.
> Of course, I don't reproduce the issue if I disable forks. However, I
> don't understand why JMH doesn't keep the classpath set when it performs
> fork.
Actually, we do propagate the classpath to the forked VM:
http://hg.openjdk.java.net/code-tools/jmh/file/98a3cd8c58ef/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java#l704
Can you post the complete log with launch options and "-v EXTRA"?
Note that if you are invoking JMH via -jar benchmarks.jar, then *JVM
launcher* is ignoring the classpath [1], and JMH is oblivious about it.
It still would not explain why your scenario works when you disable the
forks. Are you launching the JMH main class directly, without -jar?
-Aleksey.
[1]
http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html,
see "-jar".
More information about the jmh-dev
mailing list