August 22nd, 2012
Execute failed: java.io.IOException: Cannot run program "xjc": CreateProcess error=2, The system cannot find the file specified
What is this error I got from my ant build script? A CreateProcess error code 2 means that the command specified in the ant build script does not refer to any executable file on ant's lookup path. A common mistake is that the ant's build path in Eclipse is set to a JRE rather than a JDK. In order to fix this right click the build.xml file in the package explorer, then goto 'Run As' -> 'External Tools Configuration'.
In the external tools configurations window click on the JRE tab, be sure that it's currently on a JDK
After this Ant build scripts shouldn't complain about java executables anymore
Comments