windows下eclipse跑junit报错:CreateProcess error=206
from:http://isuifengfei.iteye.com/blog/1684262
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