CreateProcess error=87, The parameter is incorrect

Viewed 39725

While building with ant, I am getting the following error:

java.io.IOException: Cannot run program "D:\Tools\Java\jdk1.6.0_12\jre\bin\java.exe": (my Project & its path)Error: CreateProcess error=87, The parameter is incorrect

Any idea how to fix it?

8 Answers

I had this error in a JenkinsFile build during git checkout. It turned out that the Jenkins node config contained an empty environment variable

Node properties showing empty variable

Removing this empty variable solved the problem. Looks similar to what @bitoiu answered.

In my case, a stack trace showed up with a message cannot run program "". I figured this was due to a space character in my Jenkins shell step's shebang.

#! bash
...

The cause line reads,

Caused: java.io.IOException: Cannot run program "" (in directory "e:\jenkins_agent\workspace\FOLDER\JOB"): CreateProcess error=87, The parameter is incorrect

This was fixed by removing the space in the shebang line,

#!bash
...

setting Path in the system environment of the Jenkins agent and restarting the agent.

How to set the PATH environment variable in Jenkins configuration on Windows?

Related