Content-Length: 205810 | pFad | http://github.com/sbt/sbt-jmh/issues/241

59 Forking JMH may fail on Windows with "CreateProcess error=206, The filename or extension is too long" · Issue #241 · sbt/sbt-jmh · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forking JMH may fail on Windows with "CreateProcess error=206, The filename or extension is too long" #241

Open
piotrp opened this issue Oct 28, 2023 · 1 comment

Comments

@piotrp
Copy link

piotrp commented Oct 28, 2023

It would be great if sbt-jmh included a workaround for running with long classpaths on Windows.
Currently JMH is failing to fork benchmarks and prints:

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

This can be worked around by adding this to my sbt configuration:

    Jmh / run / javaOptions ++= (
      if (System.getProperty("os.name").startsWith("Windows")) {
        Seq("-Djmh.separateClasspathJAR=true", "\"-Djava.io.tmpdir=" + target.value + "\"")
      } else
        Seq.empty
      ),

-Djmh.separateClasspathJAR=true tells JMH to package classpath into JAR file. Setting -Djava.io.tmpdir= is required if source files aren't on the same drive as temp directory - https://github.com/openjdk/jmh/blob/1.37/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java#L874.

@piotrp piotrp changed the title Running may fail on Windows Forking JMH may fail on Windows with "CreateProcess error=206, The filename or extension is too long>" Oct 28, 2023
@piotrp piotrp changed the title Forking JMH may fail on Windows with "CreateProcess error=206, The filename or extension is too long>" Forking JMH may fail on Windows with "CreateProcess error=206, The filename or extension is too long" Oct 28, 2023
@johanandren
Copy link
Contributor

A PR would be welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/sbt/sbt-jmh/issues/241

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy