JMH 1.27 fails to work with long arguments list in JVM

Viewed 140

I tried to use JMH 1.25 in my project where list of dependencies was very huge.

Options opts = new OptionsBuilder().include(".*")
        .warmupIterations(10)
        .measurementIterations(10)
        .mode(Mode.AverageTime)
        .timeUnit(TimeUnit.NANOSECONDS).jvmArgs("-server")
        .forks(1).resultFormat(ResultFormatType.TEXT).build();

new Runner(opts).run();

However I got an error:

<failed to invoke the VM, caught IOException: Cannot run program "C:\Program Files\Java\jdk-15\bin\java.exe": 
CreateProcess error=206, The filename or extension is too long>

So I followed an advice and used new JVM argument jmh.separateClasspathJAR:

.jvmArgs("-Djmh.separateClasspathJAR=true")

However I got another error:

Exception in thread "main" java.lang.IllegalArgumentException: 'other' has different root

So I upgraded to JMH 1.27 but the exception still remained:

<failed to invoke the VM, caught IOException: Cannot run program "C:\Program Files\Java\jdk-15\bin\java.exe": 
CreateProcess error=206, The filename or extension is too long>

JMH log:

# JMH version: 1.27
# VM version: JDK 15, Java HotSpot(TM) 64-Bit Server VM, 15+36-1562
# VM invoker: C:\Program Files\Java\jdk-15\bin\java.exe
# VM options: -Djmh.separateClasspathJAR=true
# JMH blackhole mode: full blackhole + dont-inline hint
0 Answers
Related