windows下eclipse编译报错:CreateProcess error=206

http://isuifengfei.iteye.com/blog/1684262 

http://www.tuicool.com/articles/nauYf2

windows下,eclipse中运行junit出现错误提示: 
Exception occurred executing command line. 
Cannot run program "D:\Program Files\Java\jdk1.6.0_30\bin\javaw.exe" (in directory "D:\work\mywork\20120829_159367_2\biz\product"): CreateProcess error=206, ÎļþÃû»ò)չÃû 

原因是在Windows下命令行支持的字符串长度是有限制的, 
在计算机上运行 Microsoft Windows XP 或更高版本,可以在命令提示符下使用的字符串的最大的长度 8191 个字符。  
在运行 Microsoft Windows 2000 或 Windows NT 4.0 的计算机上, 将最大长度可以在命令提示符下使用的字符串的为 2047 个字符。 
(参照微软官方文档:http://support.microsoft.com/kb/830473/zh-cn) 

这个是eclipse的bug,参考:https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193 
解决办法: 
(1)下载修复包:https://bugs.eclipse.org/bugs/attachment.cgi?id=219900 
(2)把本地eclipse的eclipse/plugins/org.eclipse.jdt.launching_3.4.*.jar复制到一个安全的地方,便于恢复。 
- copy your eclipse/plugins/org.eclipse.jdt.launching_3.4.*.jar to a safe place outside of the plugins folder, so that you always have a way to revert 
- close Eclipse 
(3)把jar重命名为zip 
- rename the *.jar to *.zip 
(4)打开zip包,拷贝下载的修复包里面的四个class文件到org\eclipse\jdt\internal\launching里面 
- open the zip file and copy the 4 class files from the attachment to org\eclipse\jdt\internal\launching (replace existing files) 
(5)进入META-INF目录,删除除了MANIFEST.MF以外的所有的文件 
- go to META-INF in the zip file and delete all files except MANIFEST.MF 
(6)解压MANIFEST.MF,删除以 "NAME:"开头的所有的entry(两行是一个entry) 
- extract MANIFEST.MF to your disk and edit it with a text editor 
- remove everything starting from the first "NAME:" entry 
(7)保证MANIFEST.MF文件的结尾有两个空行 
- make sure you leave *two* (2) line break characters at the end of the file! 
(8)保存MANIFEST.MF进zip包 
- save the MANIFEST.MF and copy it back into the zip file 
(9)zip包重命名为jar 
- rename the *.zip back to *.jar 
(10)放到eclipse下面,替换之前的jar 

- enjoy

高版本的eclipse(4.3 M1)已经修复这个bug了。 

修改以后的jar包下载:http://download.csdn.net/download/goldenfish1919/6244901


问题中提到的错误信息"Cannot run program "cmd": CreateProcess error=206, 文件名扩展名太长"可能是由于文件路径过长所导致的。这个问题通常出现在Windows系统中,因为Windows对于文件路径的长度有一定的限制。引用提到的错误信息中的文件路径"C:\Program Files\Java\jdk-11.0.8\bin\java.exe"可能超过了Windows系统所允许的字符数限制。 解决这个问题的一种方法是将文件路径缩短。可以尝试将Java安装路径调整为较短的路径,比如将其安装到根目录下或者直接安装到一个不太深的文件夹中。 另外,还可以尝试使用相对路径代替绝对路径来执行命令。相对路径是相对于当前工作目录的路径,通常更短。 如果以上方法无效,还可以考虑使用文件系统的符号链接(symbolic link)来解决这个问题。符号链接是一种特殊的文件,可以将一个长路径映射到一个短路径上,从而避免文件路径过长。 总之,解决"Cannot run program "cmd": CreateProcess error=206, 文件名扩展名太长"错误的关键是缩短文件路径,可以通过调整安装路径、使用相对路径或者使用文件系统的符号链接来实现。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Idea社区版 debug 启动 Cannot run program ““ :CreateProcess error=206, 文件名扩展名太长](https://blog.csdn.net/wo240/article/details/119644123)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [eclipse develop hadoop chmod :Cannot run program "chmod": CreateProcess error=2, ?????????-附件资源](https://download.csdn.net/download/weixin_42202595/15527532)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [windowseclipse跑junit报错CreateProcess error=206](https://download.csdn.net/download/goldenfish1919/6244901)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值