无法运行程序“C:\Program Files\Java\jdk1.6.0_24\jre\bin\java.exe”:CreateProcess error=87,参数不正确
我正在尝试使用 Ant 构建一个 Web 应用程序。
我使用 JUnit 和 Cobertura 进行代码覆盖。 Junit 仅用于 DAO 测试。
当我运行 build 时,它会编译所有内容,在 JUnit 运行之前,我调用 cobertura.instrument,它调用 cobertura-instrument。
我收到以下错误,
[cobertura-instrument] The jvmargs attribute is deprecated. Please use nested jvmarg elements.
[cobertura-instrument] java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.6.0_24\jre\bin\java.exe": CreateProcess error=87, The parameter is incorrect
[cobertura-instrument] at org.apache.tools.ant.taskdefs.Java.fork(Java.java:798)
[cobertura-instrument] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:214)
[cobertura-instrument] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
[cobertura-instrument] at net.sourceforge.cobertura.ant.InstrumentTask.execute(InstrumentTask.java:199)
[cobertura-instrument] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[cobertura-instrument] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[cobertura-instrument] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[cobertura-instrument] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[cobertura-instrument] at java.lang.reflect.Method.invoke(Method.java:597)
我用谷歌搜索并发现它说
<块引用>CreateProcess 函数的最大命令行长度为 32767 个字符。此限制来自 UNICODE_STRING 结构
我的 cobertura-instrument 的 Ant 代码
<target name="coverage.instrument" depends="coverage.init,ztest.copy">
<delete file="${basedir}/cobertura.ser"/>
<cobertura-instrument todir="${coverage.instrument.dir}" maxmemory="1024M" datafile="${basedir}/cobertura.ser">
<fileset dir="${model.output.dir}">
<include name="**/*.class"/>
</fileset>
</cobertura-instrument>
</target>
我没有看到任何可以解决这个问题的方法。
有人帮我解决这个问题吗?
I am trying to build a web application using Ant.
I am using JUnit and Cobertura for code coverage. Junit is only for DAO testing.
When i run build it compiles everything and before my JUnit runs i am calling cobertura.instrument which calls cobertura-instrument.
I am getting following error
[cobertura-instrument] The jvmargs attribute is deprecated. Please use nested jvmarg elements.
[cobertura-instrument] java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.6.0_24\jre\bin\java.exe": CreateProcess error=87, The parameter is incorrect
[cobertura-instrument] at org.apache.tools.ant.taskdefs.Java.fork(Java.java:798)
[cobertura-instrument] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:214)
[cobertura-instrument] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
[cobertura-instrument] at net.sourceforge.cobertura.ant.InstrumentTask.execute(InstrumentTask.java:199)
[cobertura-instrument] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[cobertura-instrument] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[cobertura-instrument] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[cobertura-instrument] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[cobertura-instrument] at java.lang.reflect.Method.invoke(Method.java:597)
I googled and found out it says
The maximum command line length for the CreateProcess function is 32767 characters. This limitation comes from the UNICODE_STRING structure
My Ant code for cobertura-instrument
<target name="coverage.instrument" depends="coverage.init,ztest.copy">
<delete file="${basedir}/cobertura.ser"/>
<cobertura-instrument todir="${coverage.instrument.dir}" maxmemory="1024M" datafile="${basedir}/cobertura.ser">
<fileset dir="${model.output.dir}">
<include name="**/*.class"/>
</fileset>
</cobertura-instrument>
</target>
I dont see any way that i can solve this.
Anyone help me in this issue ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为指定每个类文件(将是的结果)的替代方法,请尝试使用如此处所述:http://cobertura.sourceforge.net/anttaskreference.html。这将大大减少命令行长度。
As an alternative to specifying each and every class file, which will be the result of a <fileset>, try using <instrumentationClasspath> as documented here: http://cobertura.sourceforge.net/anttaskreference.html. This would reduce the command line length considerably.