无法运行程序“C:\Program Files\Java\jdk1.6.0_24\jre\bin\java.exe”:CreateProcess error=87,参数不正确

发布于 2024-12-04 19:10:42 字数 1976 浏览 0 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拧巴小姐 2024-12-11 19:10:42

作为指定每个类文件(将是的结果)的替代方法,请尝试使用如此处所述: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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文