eclipse 无法启动应用程序(CreateProcess 错误 = 87),无法使用缩短类路径的解决方法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2893970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fail to launch application (CreateProcess error=87), can't use shorten classpath workaround
提问by Ivo Bosticky
When I launch our application in Eclipse on Windows I receive the following error:
当我在 Windows 上的 Eclipse 中启动我们的应用程序时,我收到以下错误:
Exception occured executing command line.
Cannot run program .. : CreateProcess error=87, The parameter is incorrect
执行命令行时发生异常。
无法运行程序.. : CreateProcess error=87, 参数不正确
I've solved this in the past by shortening the CLASSPATH.
我过去通过缩短 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.
我现在已经到了无法再缩短 CLASSPATH 的地步,并且想知道是否还有其他解决方法。
http://support.microsoft.com/kb/830473seems 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.
http://support.microsoft.com/kb/830473好像说明windows xp中的最大命令提示符行长度是8191个字符,唯一的解决办法是缩短文件夹名称,减少文件夹树的深度,使用参数文件,等等。
采纳答案by VonC
This eclipsecoding FAQ pagedoes confirm your diagnostic:
这个eclipsecoding 常见问题页面确实确认了您的诊断:
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.
当
CLASSPATH
时间过长时,程序无法启动(至少在 Windows 下) - 尝试缩短您的类路径。在插件的情况下,您可以尝试删除不必要的必需插件。
And you have here a threaddetailing 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?
由于您可以启动 Eclipse,但不能启动应用程序,因此我会检查您的启动配置中是否没有包含太多插件。你能检查一下你是否只添加了所需的插件吗?
回答by Nick
As a workaround:
作为解决方法:
- Open your eclipse run configuration for the task that is failing.
- Choose the classpath tab, select the default classpath, click the "Edit.." button
- Check the "Only include exported entries" checkbox.
- 打开失败任务的 eclipse 运行配置。
- 选择classpath选项卡,选择默认的classpath,点击“Edit..”按钮
- 选中“仅包括导出的条目”复选框。
This allowed me to get around this problem on Eclipse 3.6 (Helios)
这让我可以在 Eclipse 3.6 (Helios) 上解决这个问题
回答by Moe
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 Jivedevelopment ) then change the location of your .m2 by changing the maven settings.xml
这绝对是类路径过长导致命令行超出其最大限制的问题。要解决,请缩短您的类路径。如果您正在使用 Maven(就像我以前一样 - 例如在Jive开发中)然后通过更改 maven settings.xml 来更改 .m2 的位置
<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
然后将您的存储库从用户目录移动到那里,但确保 settings.xml 和 settings-security.xml(如果适用)仍在用户目录中。这样,类路径将不再一遍又一遍地显示 c:\Documents and Settings\username.m2 而是 c:.m2 允许显着减少类路径,从而显着减少命令长度。请记住,在 Windows 中,您不能(自己)创建名为 .m2 的目录,因此您必须剪切该目录,粘贴到 c: 中,然后将其复制回您的用户文件夹
回答by Imre Szikora
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
使用可以通过 juncion 轻松创建的动态链接 (http://technet.microsoft.com/en-us/sysinternals/bb896768)。为您的项目创建链接并通过该链接将其添加到 eclipse。用法例如:md d:\shortnamejunction d:\shortname\d:\my\very\long\long\long\long\long\long\projectnamefolder
回答by Aaron Digulla
This is a known bug in Eclipse: Bug 327193- [patch] Launching command line exceeds the process creation command limit on Windows
这是 Eclipse 中的一个已知错误:错误 327193- [补丁] 启动命令行超出 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.
它将在 2013 年发布的 Eclipse e4 4.3 中修复。在 3.4.2 中修复它被认为不够重要。但是在错误的附件中,您可以找到几个替换类来修复您的 Eclipse 版本。
回答by Mauro Monti
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.
我在 Eclipse 上处理同样的问题,因此,出于这个原因,我决定在 Intellij 上尝试相同的项目,只是想知道它是否是 IDE 问题。
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.
令人惊讶的是,Intellij 检测到了这个问题(长类路径)并向我展示了一个对话框,建议我使用动态类路径功能。启用此选项后,问题消失了。
What dynamic.classpath flag does is: What does the dynamic.classpath flag do? (IntelliJ project settings)
dynamic.classpath 标志的作用是: dynamic.classpath 标志有什么作用?(IntelliJ 项目设置)
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.
所以,现在我的问题是:有没有办法在 Eclipse 上做同样的事情?似乎是解决此问题的简单而优雅的解决方案,而不是手动删除所有不必要的依赖项。
回答by user1485864
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:
由于我在使用 Eclipse Helios(我们部门唯一正式支持的版本)时遇到了同样的问题,而且我很难解决这个问题,因此解决方案如下:
Install the latest Eclipse (in my case 4.3.2 did the work).
安装最新的 Eclipse(在我的例子中是 4.3.2 完成了这项工作)。
This issue had been reported as an Eclipse Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193and it is now fixed.
此问题已报告为 Eclipse 错误:https: //bugs.eclipse.org/bugs/show_bug.cgi?id =327193,现已修复。
Hope this helps future users that will reach this page.
希望这有助于将来访问此页面的用户。
回答by Rob in het Veld
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.
我遇到了同样的问题。无论我尝试过什么,尝试运行剪贴簿页面都不会成功。我检查了工作区中我的 .plugins 目录的内容。我注意到 de org.eclipse.jdt.core 目录中有很多索引文件。我重命名了这个目录,现在可以再次运行剪贴簿进程。
回答by JJ180
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
我对 Eclipse 的一种解决方案是关闭通过工作区解析启用的某些项目,而是从本地 Maven 存储库中解析这些项目。无论如何它对我有用
回答by Paramesh Korrakuti
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.
我遇到了同样的问题,项目裁判未构建 jar 文件。假设 tools-1.6.jar 已构建并添加为依赖项。稍后可能会更改tools-1.6.jar 的源代码,而不执行#mvn clean install。
I have done clean build and updated maven dependency, error was resolved.
我已经完成了干净的构建并更新了 Maven 依赖项,错误已解决。