hudson ant javac unit-tests fork=true, cannot start javac.exe compiler

Hudson is a continuous integration tool similar to CruiseControl. It has a very good web GUI for defining tasks unlike CruiseControl.
Inside it I have configured a call to an ant task.

Strangely enough in on of the projects that had to be build I got:

build.xml:200: Error running _path_to_jdk_/javac.exe compiler

Strange.

I double checked the script in eclipse. It worked.
Manual call to ant on the eclipse machine also worked.

Then I went to the Hudson machine (a test environment). I ran the script manually. The same freaking error.
I copied the whole dir to another place on the test environment: no problem.

Maybe it's the credentials: added read/write to all. Still the same error.

Then I ran the script with: ant -verbose and see what I got:

_path_\build.xml:75: _path_\javac.exe compiler
        at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:509)
        at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:61)
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:997)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:820)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        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:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.io.IOException: Cannot run program "_path_\javac.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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:828)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:445)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:459)
        at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:506)
        ... 20 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)
        ... 29 more
--- Nested Exception ---
java.io.IOException: Cannot run program "_path_\javac.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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:828)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:445)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:459)
        at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:506)
        at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:61)
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:997)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:820)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        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:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
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)
        ... 29 more

Cannot create a process?!
That's weird.

So tired enough I did something desperate:

From

<javac fork="true"

I went to


<javac fork="false"

and it worked ..... 🙁

Keep in mind that in the same build project I was calling a few other build.xml doing <javac fork="true"
several times before this one.
But this one was the only one having a reference to junit.jar (somewhere on the net I saw an article saying something about junit but don't remember what).

So I left it like this.

2 thoughts on “hudson ant javac unit-tests fork=true, cannot start javac.exe compiler”

  1. I had a similar issue where ant would fail with fork="true". It turns out it couldn't handle the default path to my Java Home. I changed the
    environment variable to point to c:\Progra~1\... instead of "c:\ Program Files\..." and it worked fine.

Leave a Reply to anonymous Cancel reply

Your email address will not be published.

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.