“CreateProcess error = 87,参数不正确”使用Ant运行Java“apt”工具

时间:2017-03-15 13:34:02

标签: java ant

从CMD调用ant时,我收到以下错误:

build.xml:1017: Error running C:\Program Files (x86)\Java\jdk1.6.0_14\bin\apt.exe compiler
  at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:525)
  at org.apache.tools.ant.taskdefs.compilers.AptExternalCompilerAdapter.execute(AptExternalCompilerAdapter.java:64)
  at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1134)
  at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:912)
  at org.apache.tools.ant.taskdefs.Apt.execute(Apt.java:265)
  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
  at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  at org.apache.tools.ant.Task.perform(Task.java:348)
  at org.apache.tools.ant.Target.execute(Target.java:390)
  at org.apache.tools.ant.Target.performTasks(Target.java:411)
  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
  at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
  at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
  at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
  at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
  at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  at org.apache.tools.ant.Task.perform(Task.java:348)
  at org.apache.tools.ant.Target.execute(Target.java:390)
  at org.apache.tools.ant.Target.performTasks(Target.java:411)
  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
  at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
  at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
  at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
  at org.apache.tools.ant.Main.runBuild(Main.java:809)
  at org.apache.tools.ant.Main.startAnt(Main.java:217)
  at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
  at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Caused
by: java.io.IOException:
Cannot run program "C:\Program Files (x86)\Java\jdk1.6.0_14\bin\apt.exe": 
CreateProcess error=87, The parameter is incorrect
  at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
  at java.lang.Runtime.exec(Runtime.java:593)
  at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
  at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
  at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
  at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:522)
  ... 33 more Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
  at java.lang.ProcessImpl.create(Native Method)
  at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
  at java.lang.ProcessImpl.start(ProcessImpl.java:30)
  at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
  ... 38 more

Ant <apt>来电代码:

<apt
    memoryinitialsize="256m"
    memorymaximumsize="256m"
    includeantruntime="true"
    destdir="${module.ejb.build.classes.dir}/apt"
    classpathref="compile.class.path"
    debug="false"
    compile="false"
    factory="net.sf.jelly.apt.freemarker.FreemarkerProcessorFactory"
    factorypathref="compile.class.path"
    preprocessdir="${module.ejb.src.dir}"
>
    <option name="template" value="${module.ejb.config.dir}/fmt/interface.fmt" />
    <src path="${module.ejb3.src.dir}" />
    <include name="**/session/*" />
    <include name="**/process/*" />
    <include name="**/sessionfacadeintapi/*" />
    <include name="**/sessionfacadeintapiV6020/*" />
    <include name="**/sessionfacadeintapiV621/*" />
    <include name="**/sessionfacade/" />
    <include name="**/agents/" />
    <include name="**/base/*" />
    <include name="**/services/*" />
</apt>

Ant构建失败。任何人都可以分享相关的修复程序吗?

0 个答案:

没有答案