I was running the Ant build for a small webservice standalone program I was getting below error -
Buildfile: C:\workspace\WebserviceExample\build.xml
wsgen:
BUILD FAILED
C:\workspace\WebserviceExample\build.xml:5: Execute failed: java.io.IOException: Cannot run program "wsgen": CreateProcess error=2, The system cannot find the file specified
Total time: 413 milliseconds
Buildfile: C:\workspace\WebserviceExample\build.xml
wsgen:
BUILD FAILED
C:\workspace\WebserviceExample\build.xml:5: Execute failed: java.io.IOException: Cannot run program "wsgen": CreateProcess error=2, The system cannot find the file specified
Total time: 413 milliseconds
This was my build.xml file-
<project default="wsgen">
<target name="wsgen" >
<exec executable="wsgen">
<arg line="-cp ./bin -keep -s ./src -d ./bin com.myfirst.wsServer.SayHello"/>
</exec>
</target>
</project>
After providing the complete path for wsgen in exec tag it worked like a charm-
<project default="wsgen">
<target name="wsgen" >
<exec executable="C:\Program Files\Java\jdk1.7.0_79\bin\wsgen">
<arg line="-cp ./bin -keep -s ./src -d ./bin com.myfirst.wsServer.SayHello"/>
</exec>
</target>
</project>
Hope it will help.