9

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?

Djizeus
  • 4,161
  • 1
  • 24
  • 42
Rakesh
  • 14,997
  • 13
  • 42
  • 62
  • 1
    possible duplicate of [Ant Blackberry Build Fails](http://stackoverflow.com/questions/6738216/ant-blackberry-build-fails) – Michael Donohue Aug 07 '11 at 06:42
  • There are some more possible solutions in the answers to that question: http://stackoverflow.com/questions/2893970/fail-to-launch-application-createprocess-error-87-cant-use-shorten-classpath – Djizeus Dec 13 '13 at 05:59

9 Answers9

7

I received this error as well, but for different cases than what is listed. I get this when attempting to execute JUnit tests in an Eclipse project whose workspace path is too long; moving the project to a shorter path resolved this issue.

Cannot run program "C:\Program Files\Java\jdk1.6.0_26\jre\bin\java.exe": (Long Project Path Path)Error: CreateProcess error=87, The parameter is incorrect

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
Jason Brant
  • 182
  • 1
  • 11
  • It is also true for any content provided to the javadoc command line (including parameter, classpath reference and such). – Vincent B. Oct 10 '13 at 01:13
2

In my case, removing duplicate jars solved the problem.

johncorner06
  • 97
  • 1
  • 7
  • For me also it worked once I removed duplicate jars. I.e I have two versions of jUnit 3.8 and jUnit 4.4. So I removed unused version so that my test cases are working fine. –  Oct 16 '12 at 10:03
2

My scenario will probably be one no one else will find. I was getting the error in IntelliJ.

After spending a long time on the web I found that I had a = in my Environment Variables, although none was set. This was the residue of a ENV Variable I had set previously but deleted. For some reason this non-editable field contained that = and the only way I could remove it was by adding a dummy ENV property and removing it again.

After I removed it, it worked.

bitoiu
  • 6,893
  • 5
  • 38
  • 60
2

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.

carl verbiest
  • 1,113
  • 1
  • 15
  • 30
0

I faced the same problem when launching my GWT application in IBM RAD.

I tried removing duplicate jars, but it didn't solved the issue.

I have changed JRE in the project build path to point to the one which is installed in my machine (C://Program Files->java->...). Earlier it was pointing to the JRE in IBM folder(C://Program Files->IBM->SDP->JDK....)

It worked for me.

Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
Badri
  • 1
0

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?

eel ghEEz
  • 1,186
  • 11
  • 24
0

I found out the reason for this error,it is pointing out only to the res folder,there is an image folder inside it,it point exactly to it,I am not getting the error.

Regards Rakesh shankar.P

Rakesh
  • 14,997
  • 13
  • 42
  • 62
0

My error for this was the parameter name was blank, specifically for "Label with parameters" plugin. Changing the name to have "Agent" in the name fixed it. This was after an update to the latest release of Jenkins.

Casterial
  • 21
  • 3
-1

I'm encountering the same issue(at least the error and description). All SO search and google search points to the bug stated at https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193 and http://www.eclipse.org/forums/index.php?t=rview&goto=494195&th=156565.

But when I try a simple change to launch the application, it works.

Previously, I'm using the way of "right click -> debug -> Java application" to start the application, and got the error.

I changed the way to manually add a debug configuration in menu "Debug -> Configurations", specify the class you want. Then click 'Debug' in the debug configurations dialog. It works...

Note that I'm using a customized IDE based on Eclipse 3.6.2.

rikitikitik
  • 2,414
  • 2
  • 26
  • 37
Ralph
  • 1
  • 1