7

I was trying building a Java plugin with Maven using Intellij IDEA until I came across an error:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.803 s
[INFO] Finished at: 2015-06-16T16:34:55-10:00
[INFO] Final Memory: 17M/216M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project mc-hyperchat: Error occurred in starting fork, check output in log -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I realize that this is because of this line (that I found using the -X flag)

Forking command line: cmd.exe /X /C ""D:\Program Files\Java\jdk1.8.0_45\jre\bin\java" -jar C:\Users\<username>\Documents\+GIT\mc-hyperchat\target\surefire\surefirebooter8505511050498586005.jar C:\Users\<username>\Documents\+GIT\mc-hyperchat\target\surefire\surefire5990474653240919844tmp C:\Users\<username>\Documents\+GIT\mc-hyperchat\target\surefire\surefire_08408900793313340679tmp"
The system cannot find the path specified.

I happen to come across somebody else with the exact same problem:

Maven Surefire 2.13 fails to fork on Windows

The accepted answer seems to be that his JAVA_HOME environment variable was invalid, so I checked mine:

enter image description here

I also echoed the variable on the Command Prompt to make sure it didn't have any quotation marks in it (also me running cmd.exe to see another The system cannot find the path specified message):

enter image description here

I'm convinced my JAVA_HOME environment variable is correct. If that's the case, what else could've caused this problem?

0

1 Answer 1

17

I found this to be a windows related error -

Open the Registry Editor Navigate to HKCU\Software\Microsoft\Command Processor\AutoRun and clear the values. Also check HKLM\Software\Microsoft\Command Processor\AutoRun.

6
  • 1
    I lost all day because of this issue.Great solution.Thanks Aug 12, 2016 at 19:21
  • I cannot believe this worked. Suddenly remembered why I switched to gradle.
    – user1094865
    Jun 2, 2017 at 15:16
  • 2
    worked for me too, I had ansicon in that entry which I installed 6 months ago when reading and practising with the book "cucumber for java"
    – Char
    Jun 21, 2017 at 7:59
  • Hey @miconico, your solution also works for me. Could you please share us the way you troubleshoot the problem to know that issue is related to that AutoRun value in Registry ? Thanks May 18, 2019 at 1:19
  • 2
    Another "worked for me". I had recently had a failed uninstall of Anaconda and my HKCU AutoRun had "C:\ProgramData\Anaconda3\condabin\conda_hook.bat".
    – D Rickard
    Jan 23, 2021 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.