0

While calling ant from CMD, I am getting the below error:

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> call code:

<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>

The Ant build is failing. Can anyone share a relevant fix?

Chad Nouis
  • 6,861
  • 1
  • 27
  • 28
Manoj
  • 1
  • 1
  • 2
  • 1
    Please edit your question and add the full error message. Run `ant -verbose` to get the full error message. Please also edit your question and add the part of your build.xml that calls apt.exe. – Chad Nouis Mar 15 '17 at 14:09
  • I have edited question with required details – Manoj Mar 15 '17 at 16:07
  • The error message has `CreateProcess error=87, The parameter is incorrect`. It appears that error 87 often happens when command lines are too long. This means the `` task may be generating a command line that is too long. See [How to set a long Java classpath in Windows?](https://stackoverflow.com/questions/201816/how-to-set-a-long-java-classpath-in-windows) for possible ways to reduce the size of the CLASSPATH. – Chad Nouis Mar 17 '17 at 14:25
  • https://stackoverflow.com/a/63860820/7919597 problem in my case was a empty environment variable in the slave configuration – Joe Apr 02 '21 at 05:06

0 Answers0