Fail to launch application (CreateProcess error=87), can't use shorten classpath workaround
Asked Answered
D

10

29

When I launch our application in Eclipse on Windows I receive the following error:

Exception occured executing command line.

Cannot run program .. : CreateProcess error=87, The parameter is incorrect

I've solved this in the past by shortening the CLASSPATH.

I've now come to a point where I can no longer shorten the CLASSPATH, and would like to know if there are any other workarounds.

http://support.microsoft.com/kb/830473 seems to indicate that the max command prompt line length in windows xp is 8191 characters, and the only solution is to shorten folder names, reduce depth of folder trees, using parameter files, etc.

Deangelo answered 23/5, 2010 at 23:35 Comment(1)
have you found any better workaround for this yet?Publishing
L
17

This eclipsecoding FAQ page does confirm your diagnostic:

When the CLASSPATH gets too long, the program cannot be launched (at least under Windows) - try to shorten your classpath. In the case of a plugin, you can try to remove unnecessary required plugins.

And you have here a thread detailing the log errors.

Since you can launch Eclipse, but not the application, I would check if you don't have too many plugins included in your launch configuration. Could you check if you have added only the required plugins?

Lowboy answered 24/5, 2010 at 0:34 Comment(0)
H
13

As a workaround:

  1. Open your eclipse run configuration for the task that is failing.
  2. Choose the classpath tab, select the default classpath, click the "Edit.." button
  3. Check the "Only include exported entries" checkbox.

This allowed me to get around this problem on Eclipse 3.6 (Helios)

Hosfmann answered 30/9, 2011 at 13:19 Comment(1)
That didn't work on SpringSource ToolSuite 2.5.1 I had to move my projects to a folder with a smaller directory path.Leon
C
2

I was dealing with the same problem on Eclipse, so, for that reason I decided to give a try to the same project on Intellij, just to know if it was a IDE problem.

Surprisingly, Intellij detects this problem (long classpath) and shows me a dialog, recommending me to use dynamic classpath feature. After enable this option, the problem gone.

What dynamic.classpath flag does is: What does the dynamic.classpath flag do? (IntelliJ project settings)

So, now my question is: Is there a way to do the same on Eclipse? seems to be a simple and elegant solution to this problems, instead of removing manually all those dependencies that are not necessary.

Clericals answered 21/11, 2011 at 18:42 Comment(0)
F
2

This is definitely an issue with the classpath being too long causing the command line to exceed it's maximum limit. to resolve, shorten your classpath. If you are using Maven (like I was - e.g. in Jive development ) then change the location of your .m2 by changing the maven settings.xml

<settings>
  <localRepository>c:/.m2/repository</localRepository>
</settings>

and then move your repository there from the user directory, but ensure that the settings.xml and settings-security.xml (if applicable) are still in the User directory. This way the class path will no longer show c:\Documents and Settings\username.m2 over and over but rather c:.m2 allowing a significant decrease in classpath and thus command length. Remember that in windows you cannot create a directory (by yourself) with name .m2, and so you have to cut the directory, paste in in c: and then copy it back into your user folder

Frons answered 22/11, 2011 at 15:43 Comment(0)
T
1

Use a dynamic link which can be easily created with juncion (http://technet.microsoft.com/en-us/sysinternals/bb896768). Create the link for your project and add it to eclipse through that. usage e.g.: md d:\shortname junction d:\shortname\ d:\my\very\long\long\long\long\long\long\projectnamefolder

Trauma answered 24/2, 2012 at 15:56 Comment(0)
W
1

This is a known bug in Eclipse: Bug 327193 - [patch] Launching command line exceeds the process creation command limit on Windows

It will be fixed with Eclipse e4 4.3 released in 2013. It wasn't deemed important enough to fix in 3.4.2. But in the attachments to the bug, you can find a couple of replacement classes to fix your version of Eclipse.

Worms answered 6/11, 2012 at 8:47 Comment(0)
C
1

Since I had the same problem with Eclipse Helios (the only version officially supported by our department) and I had a great difficulty solving the problem, here is the solution:

Install the latest Eclipse (in my case 4.3.2 did the work).

This issue had been reported as an Eclipse Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193 and it is now fixed.

Hope this helps future users that will reach this page.

Cognoscenti answered 11/3, 2014 at 14:45 Comment(0)
C
0

I encountered the same problem. Trying to run a scrapbook page would not succeed, whatever I tried. I checked the contents of my .plugins direcotry in the workspace. I noticed a lot of index files in de org.eclipse.jdt.core directory. I renamed this directory and now a scrapbook process can be run again.

Charleencharlemagne answered 4/4, 2011 at 14:14 Comment(0)
L
0

One solution I have for Eclipse, is to close certain projects that are enabled through Workspace Resolution, and instead have these be resolved from your local Maven repository. It worked for me anyways

Lashundalasker answered 2/8, 2013 at 14:54 Comment(0)
E
0

I have faced the same issue, project refereed un-build jar files. Suppose tools-1.6.jar is builded and added as dependency. Later there might be changed the source code for tools-1.6.jar and not performed #mvn clean install.

I have done clean build and updated maven dependency, error was resolved.

Endocentric answered 4/2, 2014 at 11:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.