开发者

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

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.micr开发者_如何学运维osoft.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.


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?


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)


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.


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


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


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.


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.


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜